#15903: Allow implicit (and contour, region?) plots to have legend
------------------------+----------------------------
   Reporter:  kcrisman  |            Owner:
       Type:  defect    |           Status:  new
   Priority:  major     |        Milestone:  sage-6.2
  Component:  graphics  |         Keywords:
  Merged in:            |          Authors:
  Reviewers:            |  Report Upstream:  N/A
Work issues:            |           Branch:
     Commit:            |     Dependencies:
   Stopgaps:            |
------------------------+----------------------------
 See [https://groups.google.com/forum/#!topic/sage-support/YLKxkk1H04g this
 sage-support thread].
 {{{
 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)
 }}}
 We see that legends aren't set.

 In fact,
 [http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.contour the
 mpl contour api] 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 this
 example]
 {{{
 artists, labels = cs.legend_elements()
 plt.legend(artists, labels, handleheight=2)
 }}}
 which extracts the labels from the contour legend and then puts them into
 the usual legend might be a solution.

--
Ticket URL: <http://trac.sagemath.org/ticket/15903>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to