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:
http://stackoverflow.com/questions/19385639/duplicate-items-in-legend-in-matplotlib

There is also another cleaner solution here:
http://stackoverflow.com/questions/13588920/stop-matplotlib-repeating-labels-in-legend

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.r...@ou.edu> 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 <mhea...@usgs.gov> 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.carsten...@gmail.com> 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
>
>

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to