First time here? Check out the FAQ!

Ask Your Question
1

How to put background color behind animation

asked 5 years ago

Algebear gravatar image

updated 5 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 5 years ago

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

Preview: (hide)
link

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 ( 5 years ago )

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: 5 years ago

Seen: 511 times

Last updated: May 15 '19