Ask Your Question
1

How to put background color behind animation

asked 2019-05-15 18:47:35 +0200

Algebear gravatar image

updated 2019-05-15 18:49:44 +0200

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
2

answered 2019-05-15 19:14:07 +0200

rburing gravatar image

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()

image description

edit flag offensive delete link more

Comments

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-16 00:10:13 +0200 )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

Stats

Asked: 2019-05-15 18:47:35 +0200

Seen: 382 times

Last updated: May 15 '19