Variable size markers legend formatting

Hello,

I’ve been searching but can’t seem to find this topic addressed (perhaps wrong search terms)

Simply put, I have a scatter plot with variable size markers, and I’d like to have the markers all be a single size in the legend. Is there a standard way to do this?

Thanks.

Adam,

I haven't investigated, but does the discussion of the legend marker at [1] help?

-Sterling

[1] Re: [Matplotlib-users] Legend Marker Color Bug

···

On Apr 8, 2014, at 3:44PM, Adam Hughes wrote:

Hello,

I've been searching but can't seem to find this topic addressed (perhaps wrong search terms)

Simply put, I have a scatter plot with variable size markers, and I'd like to have the markers all be a single size in the legend. Is there a standard way to do this?

Thanks.
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Thanks. That’s probably the way I’ll go. At first, I thought creating separate legend markers and removing them from the plot seemed hacky, but I guess there’s no way that matplotlib could know which legend size I want. I wonder if there’d be any interest in a PR to add a keyword to legend to handle this situation?

···

On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith <smithsp@…3304…> wrote:

Adam,

I haven’t investigated, but does the discussion of the legend marker at [1] help?

-Sterling

[1] https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25200.html

On Apr 8, 2014, at 3:44PM, Adam Hughes wrote:

Hello,

I’ve been searching but can’t seem to find this topic addressed (perhaps wrong search terms)

Simply put, I have a scatter plot with variable size markers, and I’d like to have the markers all be a single size in the legend. Is there a standard way to do this?

Thanks.


Put Bad Developers to Shame

Dominate Development with Jenkins Continuous Integration

Continuously Automate Build, Test & Deployment

Start a new project now. Try Jenkins in the cloud.

http://p.sf.net/sfu/13600_Cloudbees_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

Thanks. That's probably the way I'll go. At first, I thought creating
separate legend markers and removing them from the plot seemed hacky, but I
guess there's no way that matplotlib could know which legend size I want.
I wonder if there'd be any interest in a PR to add a keyword to legend to
handle this situation?

Why not just work the other way around with proxy artists. IOW, make the
artists but never add them to the plot.

http://matplotlib.org/users/legend_guide.html?highlight=proxy%20artists#using-proxy-artist
(works with Line2D artists)

-p

···

On Wed, Apr 9, 2014 at 9:00 AM, Adam Hughes <hughesadam87@...287...> wrote:

On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith <smithsp@...3304...>wrote:

Adam,

I haven't investigated, but does the discussion of the legend marker at
[1] help?

-Sterling

[1]
Re: [Matplotlib-users] Legend Marker Color Bug

On Apr 8, 2014, at 3:44PM, Adam Hughes wrote:

> Hello,
>
> I've been searching but can't seem to find this topic addressed
(perhaps wrong search terms)
>
> Simply put, I have a scatter plot with variable size markers, and I'd
like to have the markers all be a single size in the legend. Is there a
standard way to do this?
>
> Thanks.
>
------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
>
http://p.sf.net/sfu/13600_Cloudbees_______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Thanks Paul, I will try it out.

···

On Wed, Apr 9, 2014 at 12:21 PM, Paul Hobson <pmhobson@…287…> wrote:

On Wed, Apr 9, 2014 at 9:00 AM, Adam Hughes <hughesadam87@…287…> wrote:

Thanks. That’s probably the way I’ll go. At first, I thought creating separate legend markers and removing them from the plot seemed hacky, but I guess there’s no way that matplotlib could know which legend size I want. I wonder if there’d be any interest in a PR to add a keyword to legend to handle this situation?

Why not just work the other way around with proxy artists. IOW, make the artists but never add them to the plot.

http://matplotlib.org/users/legend_guide.html?highlight=proxy%20artists#using-proxy-artist

(works with Line2D artists)

-p


Put Bad Developers to Shame

Dominate Development with Jenkins Continuous Integration

Continuously Automate Build, Test & Deployment

Start a new project now. Try Jenkins in the cloud.

http://p.sf.net/sfu/13600_Cloudbees


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith <smithsp@…3304…> wrote:

Adam,

I haven’t investigated, but does the discussion of the legend marker at [1] help?

-Sterling

[1] https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25200.html

On Apr 8, 2014, at 3:44PM, Adam Hughes wrote:

Hello,

I’ve been searching but can’t seem to find this topic addressed (perhaps wrong search terms)

Simply put, I have a scatter plot with variable size markers, and I’d like to have the markers all be a single size in the legend. Is there a standard way to do this?

Thanks.


Put Bad Developers to Shame

Dominate Development with Jenkins Continuous Integration

Continuously Automate Build, Test & Deployment

Start a new project now. Try Jenkins in the cloud.

http://p.sf.net/sfu/13600_Cloudbees_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

Hi Paul,

I tried out the legend proxy artist, and it works for rectangles in the legend, but I can’t seem to get a Circle to appear in the legend, which I presume should be:

p = Circle((0, 0), fc=“r”)

legend([p], [“Red Rectangle”])

···

On Wed, Apr 9, 2014 at 2:20 PM, Adam Hughes <hughesadam87@…287…> wrote:

Thanks Paul, I will try it out.

On Wed, Apr 9, 2014 at 12:21 PM, Paul Hobson <pmhobson@…287…> wrote:

On Wed, Apr 9, 2014 at 9:00 AM, Adam Hughes <hughesadam87@…287…> wrote:

Thanks. That’s probably the way I’ll go. At first, I thought creating separate legend markers and removing them from the plot seemed hacky, but I guess there’s no way that matplotlib could know which legend size I want. I wonder if there’d be any interest in a PR to add a keyword to legend to handle this situation?

Why not just work the other way around with proxy artists. IOW, make the artists but never add them to the plot.

http://matplotlib.org/users/legend_guide.html?highlight=proxy%20artists#using-proxy-artist

(works with Line2D artists)

-p


Put Bad Developers to Shame

Dominate Development with Jenkins Continuous Integration

Continuously Automate Build, Test & Deployment

Start a new project now. Try Jenkins in the cloud.

http://p.sf.net/sfu/13600_Cloudbees


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith <smithsp@…3304…> wrote:

Adam,

I haven’t investigated, but does the discussion of the legend marker at [1] help?

-Sterling

[1] https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25200.html

On Apr 8, 2014, at 3:44PM, Adam Hughes wrote:

Hello,

I’ve been searching but can’t seem to find this topic addressed (perhaps wrong search terms)

Simply put, I have a scatter plot with variable size markers, and I’d like to have the markers all be a single size in the legend. Is there a standard way to do this?

Thanks.


Put Bad Developers to Shame

Dominate Development with Jenkins Continuous Integration

Continuously Automate Build, Test & Deployment

Start a new project now. Try Jenkins in the cloud.

http://p.sf.net/sfu/13600_Cloudbees_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

Adam,

I agree that the Circle ended up with a rectangle in the legend, which I wouldn't think of as the expected response. Would the following work for your purposes?

figure()
p,=plot(0,0,marker='o',ls='',color='red')
legend([p], ["Red Rectangle"],numpoints=1)
p.remove()
draw()

-Sterling

···

On Apr 11, 2014, at 8:14AM, Adam Hughes wrote:

Hi Paul,

I tried out the legend proxy artist, and it works for rectangles in the legend, but I can't seem to get a Circle to appear in the legend, which I presume should be:

p = Circle((0, 0), fc="r")
legend([p], ["Red Rectangle"])

On Wed, Apr 9, 2014 at 2:20 PM, Adam Hughes <hughesadam87@...287...> wrote:
Thanks Paul, I will try it out.

On Wed, Apr 9, 2014 at 12:21 PM, Paul Hobson <pmhobson@...287...> wrote:

On Wed, Apr 9, 2014 at 9:00 AM, Adam Hughes <hughesadam87@...287...> wrote:
Thanks. That's probably the way I'll go. At first, I thought creating separate legend markers and removing them from the plot seemed hacky, but I guess there's no way that matplotlib could know which legend size I want. I wonder if there'd be any interest in a PR to add a keyword to legend to handle this situation?

Why not just work the other way around with proxy artists. IOW, make the artists but never add them to the plot.

http://matplotlib.org/users/legend_guide.html?highlight=proxy%20artists#using-proxy-artist
(works with Line2D artists)

-p

On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith <smithsp@...3304...> wrote:
Adam,

I haven't investigated, but does the discussion of the legend marker at [1] help?

-Sterling

[1] Re: [Matplotlib-users] Legend Marker Color Bug

On Apr 8, 2014, at 3:44PM, Adam Hughes wrote:

> Hello,
>
> I've been searching but can't seem to find this topic addressed (perhaps wrong search terms)
>
> Simply put, I have a scatter plot with variable size markers, and I'd like to have the markers all be a single size in the legend. Is there a standard way to do this?
>
> Thanks.
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees_______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Hey Adam,

I wouldn’t make a circle, instead use a Line2D artist (accessible from pyplot) with they same (base) symbology as your scatter plot. It has pretty much the same call signature as ax.plot

-paul

···

On Fri, Apr 11, 2014 at 9:35 AM, Sterling Smith <smithsp@…3304…> wrote:

Adam,

I agree that the Circle ended up with a rectangle in the legend, which I wouldn’t think of as the expected response. Would the following work for your purposes?

figure()

p,=plot(0,0,marker=‘o’,ls=‘’,color=‘red’)

legend([p], [“Red Rectangle”],numpoints=1)

p.remove()

draw()

-Sterling

On Apr 11, 2014, at 8:14AM, Adam Hughes wrote:

Hi Paul,

I tried out the legend proxy artist, and it works for rectangles in the legend, but I can’t seem to get a Circle to appear in the legend, which I presume should be:

p = Circle((0, 0), fc=“r”)

legend([p], [“Red Rectangle”])

On Wed, Apr 9, 2014 at 2:20 PM, Adam Hughes <hughesadam87@…287…> wrote:

Thanks Paul, I will try it out.

On Wed, Apr 9, 2014 at 12:21 PM, Paul Hobson <pmhobson@…287…> wrote:

On Wed, Apr 9, 2014 at 9:00 AM, Adam Hughes <hughesadam87@…287…> wrote:

Thanks. That’s probably the way I’ll go. At first, I thought creating separate legend markers and removing them from the plot seemed hacky, but I guess there’s no way that matplotlib could know which legend size I want. I wonder if there’d be any interest in a PR to add a keyword to legend to handle this situation?

Why not just work the other way around with proxy artists. IOW, make the artists but never add them to the plot.

http://matplotlib.org/users/legend_guide.html?highlight=proxy%20artists#using-proxy-artist

(works with Line2D artists)

-p

On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith <smithsp@…3304…> wrote:

Adam,

I haven’t investigated, but does the discussion of the legend marker at [1] help?

-Sterling

[1] https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25200.html

On Apr 8, 2014, at 3:44PM, Adam Hughes wrote:

Hello,

I’ve been searching but can’t seem to find this topic addressed (perhaps wrong search terms)

Simply put, I have a scatter plot with variable size markers, and I’d like to have the markers all be a single size in the legend. Is there a standard way to do this?

Thanks.


Put Bad Developers to Shame

Dominate Development with Jenkins Continuous Integration

Continuously Automate Build, Test & Deployment

Start a new project now. Try Jenkins in the cloud.

http://p.sf.net/sfu/13600_Cloudbees_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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


Put Bad Developers to Shame

Dominate Development with Jenkins Continuous Integration

Continuously Automate Build, Test & Deployment

Start a new project now. Try Jenkins in the cloud.

http://p.sf.net/sfu/13600_Cloudbees


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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