Legend for a scatter plot based on symbols

Hi,

I’d like to plot three scatter plots on the same figure, each with different symbols. Associated to these scatter plots, I’d like to put a legend. For the moment, the legend is based on one of the color of the associated scatter plot, but it is not relevant. Indeed, the colors are not identical inside one scatter plot, so the displayed color is discriminating.
So I’d like to display the symbol (circle, square, cross, …) instead of the color rectangle. Is it possible ?

Thanks,

Matthieu

···


French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher

Hi Matthieu,

I'm not sure if somebody else already answered to your question and I don't
know the best way to achieve what you need, but I suggest the following
work-around:

scatter(x, x**2.4, marker='s', color='r', s=25, label="_")
# with no label

plot([0], [0], ls='', marker='s', color='r', ms=5, mew=0, label="my label")
# plot somewhere outside the shown axis with the preferred label

legend()

Best regards
Matthias

···

On Friday 30 May 2008 11:20:08 Matthieu Brucher wrote:

Hi,

I'd like to plot three scatter plots on the same figure, each with
different symbols. Associated to these scatter plots, I'd like to put a
legend. For the moment, the legend is based on one of the color of the
associated scatter plot, but it is not relevant. Indeed, the colors are not
identical inside one scatter plot, so the displayed color is
discriminating. So I'd like to display the symbol (circle, square, cross,
...) instead of the color rectangle. Is it possible ?

Thanks,

Matthieu

Hi,

Thanks for the tips, I’ll try that :slight_smile:

Matthieu

2008/6/4 Matthias Michler <MatthiasMichler@…361…>:

···

Hi Matthieu,

I’m not sure if somebody else already answered to your question and I don’t

know the best way to achieve what you need, but I suggest the following

work-around:

scatter(x, x**2.4, marker=‘s’, color=‘r’, s=25, label=“_”)

with no label

plot([0], [0], ls=‘’, marker=‘s’, color=‘r’, ms=5, mew=0, label=“my label”)

plot somewhere outside the shown axis with the preferred label

legend()

Best regards

Matthias

On Friday 30 May 2008 11:20:08 Matthieu Brucher wrote:

Hi,

I’d like to plot three scatter plots on the same figure, each with

different symbols. Associated to these scatter plots, I’d like to put a

legend. For the moment, the legend is based on one of the color of the

associated scatter plot, but it is not relevant. Indeed, the colors are not

identical inside one scatter plot, so the displayed color is

discriminating. So I’d like to display the symbol (circle, square, cross,

…) instead of the color rectangle. Is it possible ?

Thanks,

Matthieu


Check out the new SourceForge.net Marketplace.

It’s the best place to buy or sell services for

just about anything Open Source.

http://sourceforge.net/services/buy/index.php


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92

LinkedIn : http://www.linkedin.com/in/matthieubrucher