Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Add legend to implicit_plot for different parameter values

Hi, I want to add a legend to an implicit plot, to plot the same function for different parameter values. I can plot the functions but the legend is not displayed. Is it possible to do it?

var('x y z')
xrange = (x,0,2)
yrange = (y,0,2)
z=1
g1 = implicit_plot(x**3-2*x+y**2==z,xrange,yrange,color='red',legend_label='g1')
z=2 
g2 = implicit_plot(x**3-2*x+y**2==z,xrange,yrange,color='blue',legend_label='g2') 
g = g1+g2
g.legend(True)
g.show(legend_loc='upper right',frame=True)