On Thursday, March 6, 2014 2:24:00 PM UTC-5, Liam Dalton wrote:
>
> I have similar issues when running your code. However, the same code works
> if you do not do implicit plotting:
>
> var('x y')
> xrange = (x,0,5)
> yrange = (y,0,5)
> f1 = plot(x**2,xrange,color='red',legend_label='x^2 - 4x + y^2 == 0')
> f2 = plot(x,xrange,legend_label='x*y==1')
> result = f1+f2
> result.legend(True)
> result.show(legend_loc='upper right',frame=True)
>
> To me this implies that the problem is with implicit plotting.
>
>>
>>
Correct - I've been playing with this for the past few minutes, and contour
plots (of which implicit plots are a subset) simply don't do this, even
though there is code in the ContourPlot class to handle legends!
http://git.sagemath.org/sage.git/tree/src/sage/plot/contour_plot.py#n191
for implicit plot situation.
var('x y')
P = contour_plot(x^2+y^2==1,(x,-1,1),(y,-1,1),plot_points=150,
contours=(0,0), fill=False, cmap=["blue"],legend_label='test')
print P.legend()
P.legend(True)
print P.legend()
print P[0].options()['legend_label']
show(P)
shows this. Not only this, but the legend is inexplicably not set to True.
I have a feeling that we need to do what we do in plot/disk.py or
something; my guess (only a guess) is that the matplotlib thing that does
contour plots (contour) only accepts labels directly for the individual
contours, which
is http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.clabel
In
fact, http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.contour
seems to confirm that we shouldn't be trying to label contour plots with
legends. (Which makes sense, since they have their own labeling mechanism).
However, for implicit plots, this might cause a problem. A workaround
like at the bottom of
http://matplotlib.org/examples/pylab_examples/contourf_hatching.html
might work.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.