ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 22 Dec 2010 04:22:36 +0100No legend when plotting list of pointshttps://ask.sagemath.org/question/7788/no-legend-when-plotting-list-of-points/When I plot points using Sage 4.6 the legend is not drawn.
Running this in notebook:
pts = [point((i, gauss(0,1)),) for i in range(100)]
plot(pts, legend_label='My points').show() #No legend
plot(cos(x), legend_label='cos(x)').show() #This works!
The cos(x) plot works, but not for points, how's that?
Is is a bug, or is it some other library than matplotlib used when plotting points?Fri, 03 Dec 2010 08:17:32 +0100https://ask.sagemath.org/question/7788/no-legend-when-plotting-list-of-points/Answer by Jason Grout for <p>When I plot points using Sage 4.6 the legend is not drawn.</p>
<p>Running this in notebook:</p>
<pre><code>pts = [point((i, gauss(0,1)),) for i in range(100)]
plot(pts, legend_label='My points').show() #No legend
plot(cos(x), legend_label='cos(x)').show() #This works!
</code></pre>
<p>The cos(x) plot works, but not for points, how's that?</p>
<p>Is is a bug, or is it some other library than matplotlib used when plotting points?</p>
https://ask.sagemath.org/question/7788/no-legend-when-plotting-list-of-points/?answer=11895#post-id-11895This works and is much simpler:
sage: points([(i, gauss(0,1)) for i in range(100)], legend_label='My points',ymax=10)
(the ymax is in there to make room for the legend).
It appears when plot takes in a list of things to plot, it may not pass the legend_label argument down to each thing it is plotting. I've made this [trac #10514](http://trac.sagemath.org/sage_trac/ticket/10514)
Wed, 22 Dec 2010 04:22:36 +0100https://ask.sagemath.org/question/7788/no-legend-when-plotting-list-of-points/?answer=11895#post-id-11895