legend for plots with points

Hi all,

I apologize if this was asked before. I just started adding legends to my
plots
and found the legend stile for a point-plot, i.e. a plot using points rather
than
lines to be a bit confusing.

Example:
pylab.plot(arange(5), arange(5), 'o', label="foo")
pylab.legend()

Will produce a legend which looks like "o o foo".
Why are there two points? Can I force it to give me only one?
Thanks!

Regards,

Maximilian

···

--
View this message in context: http://www.nabble.com/legend-for-plots-with-points-tp21680968p21680968.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

mfabulous wrote:

Hi all,

I apologize if this was asked before. I just started adding legends to my
plots and found the legend stile for a point-plot, i.e. a plot using points rather
than lines to be a bit confusing.

Example:
pylab.plot(arange(5), arange(5), 'o', label="foo")
pylab.legend()

Will produce a legend which looks like "o o foo".
Why are there two points? Can I force it to give me only one?

That may depend on how old your version of matplotlib is; for quite a while there has been a "numpoints" kwarg to the legend command which lets you set that number, e.g., "pylab.legend(numpoints=1)".

Eric

mfabulous wrote:

Hi all,

I apologize if this was asked before. I just started adding legends to my
plots
and found the legend stile for a point-plot, i.e. a plot using points
rather
than
lines to be a bit confusing.

Example:
pylab.plot(arange(5), arange(5), 'o', label="foo")
pylab.legend()

Will produce a legend which looks like "o o foo".
Why are there two points? Can I force it to give me only one?

That may depend on how old your version of matplotlib is; for quite a
while there has been a "numpoints" kwarg to the legend command which
lets you set that number, e.g., "pylab.legend(numpoints=1)".

Eric

Thats it...

thank you!

Cheers,

Maximilian

···

--
View this message in context: http://www.nabble.com/legend-for-plots-with-points-tp21680968p21689742.html
Sent from the matplotlib - users mailing list archive at Nabble.com.