Ask Your Question

elliptic curves plot

asked 2017-05-22 16:19:41 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

The legend shows the functions twice. I don't like that. How can I change it, that the function is only once showed? Thank you :)


p=plot(EllipticCurve([0,0,0,3,0]), gridlines='true', color=hue(0.7),xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3+3x$')
p+=plot(EllipticCurve([0,0,0,2,0]), gridlines='true', color='cornflowerblue',xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3+2x$')
p+=plot(EllipticCurve([0,0,0,1,0]), gridlines='true', color='red',xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3+x$')
p+=plot(EllipticCurve([0,0,0,-1,0]), gridlines='true', color='orange',xmin=-4, xmax=4, ymin=-3, ymax=3)
p+=plot(EllipticCurve([0,0,0,-2,0]), gridlines='true', color=hue(0.2),xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3-2x$')
p+=plot(EllipticCurve([0,0,0,-3,0]), gridlines='true', color=hue(0.3),xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3-3x$')
p+=point((-3,0), color='white', legend_label='$y^2=x^3-x$')

p.set_legend_options(shadow=False, loc=2)
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2017-05-23 02:30:40 -0500

ndomes gravatar image
sage: C = EllipticCurve([0,0,0,-2,0]).plot(xmin=-4, xmax=4, ymin=-3, ymax=3)
sage: print C

Graphics object consisting of 2 graphics primitives

I suppose the legend label entry shows up twice because there are two graphics primitives. You can split the plot and set the legend_label option only once.

sage: p= plot(EllipticCurve([0,0,0,-2,0]), gridlines='true', color=hue(0.2),xmin=-4, xmax=0, ymin=-3, ymax=3, legend_label='$y^2=x^3-2x$')
sage: p+=plot(EllipticCurve([0,0,0,-2,0]), gridlines='true', color=hue(0.2),xmin=1, xmax=4, ymin=-3, ymax=3) 
sage: p.set_legend_options(shadow=False, loc=2)
sage: show(p)
edit flag offensive delete link more

answered 2017-05-22 17:11:08 -0500

kcrisman gravatar image

The reason this would be happening depends upon your Sage interface method. For instance, in the Sage cell server this produces an image along with a link to the saved file. However, in some notebooks and perhaps in your command line, the save method would have a hook that takes a saved image and shows it.

So what I would recommend is to just save it once if your method is showing saved files. There shouldn't really be any reason to do it twice anyway, right?

edit flag offensive delete link more

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: 2017-05-22 16:19:41 -0500

Seen: 56 times

Last updated: May 23