Toggling country boundaries in MPL Basemap

Mauro Cavalcanti wrote:

Dear Jeff,

Thanks for your fast reply. Unfortunately, I have not been able to get
yet working:

I have a menu event like this:

borders = []
if self.MapDrawBorderItem.IsChecked():
  borders = self.map.drawcountries()
else:
  self.ax.lines.remove(borders)
       # .... redraw the map here...

But I got a ValueError: list.remove(x): x not in list

Any hints?
  
Mauro: Instead of

self.ax.lines.remove(borders)

I think should simply do

borders.remove()

-Jeff

···

With best regards,

2008/12/5 Jeff Whitaker <jswhit@...146...>:
  

Mauro Cavalcanti wrote:
    

Dear ALL,

Always engaged in pushing MPL/Basemap ahead of its limits, here am I
again with a humble question: I want to be able to toggle the display
of country boundaries on a map using a menu option on my wxPython
interface. It is quite easy to initially plotting a map without
borders and then toggling them on, but I could not figure out a way to
toggling them off (if possible, without redrawing the whole map). Is
there any trick to do this? :wink:

Thanks in advance!

With warmest regards,

Mauro:

The drawcountries() method returns a matplotlib line collection. Invoking
the remove() method of the line collection will remove the countries from
the axes instance.

-Jeff

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg