# elliptic curves plot

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

code:

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$')

show(p)
p.axes_labels(['$x$','$y$'])
p.save('Einleitung2.pdf')

edit retag close merge delete

Sort by ยป oldest newest most voted
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: show(p)

more

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?

more