[Matplotlib-users] legend for a plot with markers every 20th data point?

2007-04-11 Thread Maddox Flower
Hi there, say, I have x and y data like this (the real data I am working with is from numerical simulations, though): from numpy import arange, sin x = arange( 0., 1., 0.001 ) y = sin( 50*x ) Now, a line plot would not look very decent because of the 1000 overlapping markers: plot(x, y, '-ro')

Re: [Matplotlib-users] legend for a plot with markers every 20th data point?

2007-04-11 Thread Maddox Flower
Jouni K. Seppänen wrote: > Make the legend first with only the line, then modify the line within > the legend: > > from numpy import arange, sin > x = arange( 0., 1., 0.001 ) > y = sin( 50*x ) > line = plot(x, y, '-r') > markers = plot(x[::20], y[::20], 'ro') > lgd = legend([line], ['data'], numpo