How to color specific region of plot. SageMath

Viewed 93

enter image description here

I am starting a project involving Continued Fractions on Hecke triangle surfaces and I would like to color the area over the half circle and between the two vertical lines. How could I do it using sagemath python?

from sage.plot.line import Line
var('x')
e = sqrt(1-x^2)
f = line([(-1/2, sqrt(3)/2), (-1/2, 3)])
g = line([(1/2, sqrt(3)/2), (1/2, 3)])

show(plot(e) + g + f, aspect_ratio=1)
1 Answers

I used region_plot and delimited the area over the half circle and between the lines.

t = region_plot( y > sqrt(1-x^2), (x,-1/2,1/2), (y,-2,3), incol='red', 
bordercol='gray')
show(plot(e) + g + f + t, aspect_ratio=1)
Related