# How to put background color behind animation

So I read some of the questions and answers on this site but none of them got me a clear answer. I'm making an animation showing the group law of an elliptic curve. Anyways, I want it to look perfect so I simply need a positive colored background; I was thinking light green (maybe use hue). (Besides, where can I find a table that lists all the values of the hue colors without having to compute them myself?) My animation consists of a few frames played very slowly. My first frame is simply the curve. I had the idea to put it all in a big colored polygon to achieve the background. I could not find simple background color options for plots. This is my poor attempt:

E = EllipticCurve(y^2==x^3+4*x^2-5*x+2);
L = [(-6,-20),(-6,20),(6,20),(6,-20)];
frames = plot(E,xmin=-6,xmax=6,ymin=-20,ymax=20,color='red',thickness=3);
frames += polygon(L,color=hue(0.40));


The problem is now that my plot is completely deformed... Of course, this looks very unpleasent. Anyone got an idea to deform the polygon such that the plot of this elliptic curve is nicely like it looks standard, as evaluating plot(E,xmin=-6,xmax=6,ymin=-20,ymax=20,color='red',thickness=3)? Oh, and also the color should be a bit more transparent. Thanks for the time.

edit retag close merge delete

Sort by » oldest newest most voted

Use aspect_ratio to control the aspect ratio (which was "deformed" by adding the polygon), and alpha for transparency, e.g.:

var('x,y')
E = EllipticCurve(y^2==x^3+4*x^2-5*x+2)
L = [(-6,-20),(-6,20),(6,20),(6,-20)]
frames = plot(E,xmin=-6,xmax=6,ymin=-20,ymax=20,color='red',thickness=3,aspect_ratio=1/6)
frames += polygon(L,color=hue(0.40),alpha=1/3,aspect_ratio=1/6)
frames.show()


more

Thanks, it works well. I have deleted the axes and only included a plain horizontal axis without scale. Also, I know have a green square, that looks the best imo.

( 2019-05-15 17:10:13 -0500 )edit