Ask Your Question

No legend when plotting list of points

asked 2010-12-03 08:17:32 +0200

mandrake gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2010-12-22 04:22:36 +0200

Jason Grout gravatar image

updated 2010-12-22 04:25:23 +0200

This 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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2010-12-03 08:17:32 +0200

Seen: 395 times

Last updated: Dec 22 '10