Dear ALL,
Am I intending to change the world's geography? No, not quite. I just
would like to know how to deal with the following problem, I have
stumbled upon in MPL/Basemap: I have a line:
continents = map.fillcontinents(color='coral, lake_color='blue')
where map is, of course, a Basemap instance
According to the Basemap documentation, the Basemap.fillcontinents()
method returns a matplotlib.patches.Polygon object.
Later on, I do the following, in an attempt to erase this object:
del continents
But nothing happens.
If I try instead continents.remove(), I got an error message:
TypeError: remove() takes exactly one argument (0 given) what is not
suprising as the objet returned by fillcontinents() is not a list.
Any hints?
Thanks in advance!
With best wishes,
···
--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."
Mauro Cavalcanti wrote:
Dear ALL,
Am I intending to change the world's geography? No, not quite. I just
would like to know how to deal with the following problem, I have
stumbled upon in MPL/Basemap: I have a line:
continents = map.fillcontinents(color='coral, lake_color='blue')
where map is, of course, a Basemap instance
According to the Basemap documentation, the Basemap.fillcontinents()
method returns a matplotlib.patches.Polygon object.
Later on, I do the following, in an attempt to erase this object:
del continents
But nothing happens.
If I try instead continents.remove(), I got an error message:
TypeError: remove() takes exactly one argument (0 given) what is not
suprising as the objet returned by fillcontinents() is not a list.
Any hints?
Thanks in advance!
With best wishes,
Mauro: That's a bug - the fillcontinents method was only returning the last Polygon instance drawn. I've fixed it in SVN (r6579) to return a list of all the Polygon instances. You can now iterate over that list and remove each Polygon, like this
contpolys = m.fillcontinents()
for contpoly in contpolys:
contpoly.remove()
Thanks for the bug report.
-Jeff
···
--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328