basemap drawcoastlines: suppress legend label

Jeff,

When putting a legend on a basemap plot, I find that the legend command picks up the coastline line collection and gives it an uninformative label. I suspect this is rarely what one wants. Two suggestions:

1) In drawcoastlines, use "coastlines.set_label('_nolabel_') to suppress inclusion in the legend, and similarly for drawcountries, etc.

2) Make drawcoastlines return the line collection that it creates. Similarly, drawcountries could return the line collection, fillcoastlines could return the list of patches, etc. Drawparallels and drawmeridians are a little more complicated because they make the labels as well as the lines, so I am not sure what to do with them.

Granted, one can grab the reference to the line collection from the end of ax.collections, but it seems cheap, reasonable, and more convenient to simply have it returned by the command that makes it.

Eric

Eric Firing wrote:

Jeff,

When putting a legend on a basemap plot, I find that the legend command picks up the coastline line collection and gives it an uninformative label. I suspect this is rarely what one wants. Two suggestions:

1) In drawcoastlines, use "coastlines.set_label('_nolabel_') to suppress inclusion in the legend, and similarly for drawcountries, etc.
  

Eric:

Done for coastlines, rivers, countries and states.

2) Make drawcoastlines return the line collection that it creates. Similarly, drawcountries could return the line collection, fillcoastlines could return the list of patches, etc.

All done.

Drawparallels and drawmeridians are a little more complicated because they make the labels as well as the lines, so I am not sure what to do with them.
  
drawmeridians and drawmeridians now return dictionaries, with the Line2D and Text instances associated with each latitude or longitude.
Granted, one can grab the reference to the line collection from the end of ax.collections, but it seems cheap, reasonable, and more convenient to simply have it returned by the command that makes it.

Eric

Thanks for the suggestion.

-Jeff

ยทยทยท

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...236...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory