markers with same size in legend box

Is there a way to have all markers in the legend box have the same size?
www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg

I came up with a solution by plotting a marker outside the latitude
and longitude range, but that's not a very good solution.

Thanks for your time.

Your solution is about as good as "proxy artists" in legends, which would be the official method. (Google "proxy artist matplotlib".)

It may be relevant that you can access the marker of the legend entries with the _marker attribute of the handles. Search the mailing list archives for this one.

-Sterling

···

On Oct 23, 2014, at 8:05PM, Tommy Carstensen wrote:

Is there a way to have all markers in the legend box have the same size?
www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg

I came up with a solution by plotting a marker outside the latitude
and longitude range, but that's not a very good solution.

Thanks for your time.

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Thanks for feedback Thomas and Sterling. Here is the ugly solution I
ended up with:

# plot a marker with a blank label
    map.plot(x, y, 'o', markersize=markersize, markerfacecolor=color, label="")
# specify a coordinate outside the map region (Africa)
    x,y = map(-60, -60)
# use a fixed markersize for coordinates outside the map region and
use a non-blank label
    map.plot(x, y, 'o', markersize=10, markerfacecolor=color, label=label)

I should have used proxy artists as suggested by Sterling. Here is an example:

http://matplotlib.org/users/legend_guide.html#proxy-legend-handles

import matplotlib.patches as mpatches
import matplotlib.pyplot as plt

red_patch = mpatches.Patch(color='red', label='The red data')
plt.legend(handles=[red_patch])

plt.show()

···

On Fri, Oct 24, 2014 at 7:36 PM, Sterling Smith <smithsp@...3304...> wrote:

Your solution is about as good as "proxy artists" in legends, which would be the official method. (Google "proxy artist matplotlib".)

It may be relevant that you can access the marker of the legend entries with the _marker attribute of the handles. Search the mailing list archives for this one.

-Sterling

On Oct 23, 2014, at 8:05PM, Tommy Carstensen wrote:

Is there a way to have all markers in the legend box have the same size?
www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg

I came up with a solution by plotting a marker outside the latitude
and longitude range, but that's not a very good solution.

Thanks for your time.

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options