Ask Your Question

How to put background color behind animation

asked 2019-05-15 11:47:35 -0500

Algebear gravatar image

updated 2019-05-15 11:49:44 -0500

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-05-15 12:14:07 -0500

rburing gravatar image

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

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)

image description

edit flag offensive delete link 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.

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-05-15 11:47:35 -0500

Seen: 17 times

Last updated: May 15