Ask Your Question
0

Bug in legend_label of list_plot?

asked 2012-11-10 16:44:35 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi, Suppose lstR and lstS are two lists of real numbers.

X = list_plot(lstR, plotjoined = True, color='black', marker = 'o', linestyle="-", legend_label='$R$', axes_labels=['Trial number', 'Value'])
Y = list_plot(lstS, plotjoined = True, color='black', marker = 's', linestyle="--", legend_label='$S$', axes_labels=['Trial number', 'Value'])      
(X+Y).show()

The legend label for R is two squares joined by a line instead of two circles joined by a line. Is this a bug? (I am unable to upload the plot image because my karma is not > 60.)

edit retag flag offensive close merge delete

Comments

On the other hand, `(X+Y).save('tmp.eps')` displays the legend labels correctly.

Iftikhar Burhanuddin gravatar imageIftikhar Burhanuddin ( 2012-11-10 17:41:27 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2012-11-11 17:09:46 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I recently filed a bug report on this. Problem seems somewhere in sage. It's hard to figure out where :( The problem is only in the marker type 'o'; the other marker types work just fine. So, simply avoid 'o'!

See: http://trac.sagemath.org/sage_trac/ti...

edit flag offensive delete link more

Comments

We just realized that the upgrade to matplotlib 1.2.0 fixes this issue. See the trac ticket above for discussion.

Jason Grout gravatar imageJason Grout ( 2012-11-12 03:28:47 -0600 )edit
0

answered 2012-11-10 17:32:13 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Yes, it is a bug. Thanks for posting about this!

Here is a minimal example showing that the real problem is that if marker='o', then the legend shows a square while the graph shows a circle.

edit flag offensive delete link more

Comments

How do I circumvent this bug to get the legend labels right?

Iftikhar Burhanuddin gravatar imageIftikhar Burhanuddin ( 2012-11-10 17:37:55 -0600 )edit

It looks like things work well if you avoid `marker='o'`

Jason Grout gravatar imageJason Grout ( 2012-11-10 17:43:45 -0600 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2012-11-10 16:44:35 -0600

Seen: 138 times

Last updated: Nov 11 '12