avoid duplicate legends

How does one avoid duplicate legends?
www.tommycarstensen.com/python2_matplotlib_basemap_merc_bluemarble_hresolution.jpg

Can I make the legend size smaller than the marker size?

For your first question: Use the legend "numpoints" keyword. I think
if you set it to 1, it should solve that problem.

For your second question, I'm not sure, but I'll bet if you poke
around in the Legend object returned by the function, you'll find
something.

···

On Mon, Oct 20, 2014 at 8:04 AM, Tommy Carstensen <tommy.carstensen@...287...> wrote:

How does one avoid duplicate legends?
www.tommycarstensen.com/python2_matplotlib_basemap_merc_bluemarble_hresolution.jpg

Can I make the legend size smaller than the marker size?

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Legends entries are blindly constructed. Each plotting call that has a legend keyword argument will produce a legend entry if you are automatically building the legend. You can pass a label value of “nolabel” to prevent an entry if you know you are about to do something that would duplicate the entries. Another approach is to manually collect unique artists and manually build the legend (I think there is an example of that in the gallary).

As for configuring the legend, there are a bunch of parameters that can be set for sizing the font. I think the sizing of the marker is determined by their size in the plot, though.

Cheers!
Ben Root

···

On Mon, Oct 20, 2014 at 10:46 AM, Hearne, Mike <mhearne@…924…> wrote:

For your first question: Use the legend “numpoints” keyword. I think

if you set it to 1, it should solve that problem.

For your second question, I’m not sure, but I’ll bet if you poke

around in the Legend object returned by the function, you’ll find

something.

On Mon, Oct 20, 2014 at 8:04 AM, Tommy Carstensen

<tommy.carstensen@…1896…> wrote:

How does one avoid duplicate legends?

www.tommycarstensen.com/python2_matplotlib_basemap_merc_bluemarble_hresolution.jpg

Can I make the legend size smaller than the marker size?


Comprehensive Server Monitoring with Site24x7.

Monitor 10 servers for $9/Month.

Get alerted through email, SMS, voice calls or mobile push notifications.

Take corrective actions from your mobile device.

http://p.sf.net/sfu/Zoho


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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


Comprehensive Server Monitoring with Site24x7.

Monitor 10 servers for $9/Month.

Get alerted through email, SMS, voice calls or mobile push notifications.

Take corrective actions from your mobile device.

http://p.sf.net/sfu/Zoho


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

I was able to solve my two problems by doing label="" and numpoints=1.
Thank you very much for your help.

I found my solution here:

There is also another cleaner solution here:

import matplotlib
matplotlib.use('Agg')
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
map = Basemap()
map.plot(label="")
plt.legend(numpoints=1)

···

On Mon, Oct 20, 2014 at 8:11 AM, Benjamin Root <ben.root@...1304...> wrote:

Legends entries are blindly constructed. Each plotting call that has a
legend keyword argument will produce a legend entry if you are automatically
building the legend. You can pass a label value of "__nolabel__" to prevent
an entry if you know you are about to do something that would duplicate the
entries. Another approach is to manually collect unique artists and manually
build the legend (I think there is an example of that in the gallary).

As for configuring the legend, there are a bunch of parameters that can be
set for sizing the font. I think the sizing of the marker is determined by
their size in the plot, though.

Cheers!
Ben Root

On Mon, Oct 20, 2014 at 10:46 AM, Hearne, Mike <mhearne@...924...> wrote:

For your first question: Use the legend "numpoints" keyword. I think
if you set it to 1, it should solve that problem.

For your second question, I'm not sure, but I'll bet if you poke
around in the Legend object returned by the function, you'll find
something.

On Mon, Oct 20, 2014 at 8:04 AM, Tommy Carstensen >> <tommy.carstensen@...287...> wrote:
> How does one avoid duplicate legends?
>
> www.tommycarstensen.com/python2_matplotlib_basemap_merc_bluemarble_hresolution.jpg
>
> Can I make the legend size smaller than the marker size?
>
>
> ------------------------------------------------------------------------------
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push
> notifications.
> Take corrective actions from your mobile device.
> http://p.sf.net/sfu/Zoho
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options