Ask Your Question

showing dashed line in the legend box

asked 2015-05-29 02:51:48 -0500

Nownuri1 gravatar image

updated 2015-05-30 05:23:06 -0500

Could anyone let me know how you can change the style of the line in the legend box? I'm struggling with this for 2 hours. I can only change the fontsize of legend_label and color and etc. Please help me!

This is a part of my code for the plot

Lg1=plot(f1, (x, 1, 100),  ticks=[None, [0.000005, 1/5, 10^-5, 10^-4, 10^-3, 10^-2, 10^-1]], scale=('loglog', 10), ymin=0, ymax=1, axes_labels=['Distance between led and camera [m]','Illuminace on camera sensor[lux]'],axes=None, axes_pad=False, legend_label='$I=2cd$, $L_s=50m$', frame=True, color='blue');
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-05-29 07:36:17 -0500

kcrisman gravatar image

updated 2015-05-29 07:44:25 -0500

Believe it or not, there is a very subtle difference between linestyle='--' and the default, but you are right that it's not really visible and I've opened ticket 18543 for this.

Edit: as a workaround, you can do

sage: P = plot(x,(x,1,100),linestyle='--', legend_label='foo')
sage: P.set_legend_options(handlelength=2)
sage: P

and perhaps that will be nicer anyway. See here for the full set of legend options.

edit flag offensive delete link more


Thank you for the answer. It means that the reason why I couldn't see dashed lines in the legend was just the small size of legend box. Is it correct?

Nownuri1 gravatar imageNownuri1 ( 2015-05-30 05:22:06 -0500 )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

1 follower


Asked: 2015-05-29 02:51:48 -0500

Seen: 106 times

Last updated: May 30 '15