Dear Jeff, Thanks a lot, as always, for your help! I just expected that it could be some sort of 'one-line' solution to the removing of parallel/meridian lines, avoiding the need to use a loop (as I want to remove all the lines at once). But, of course, it works!
I will take this opportunity to ask you if there are plans to release, as a regular MS-Windows executable, the lastest version of Basemap (0.99.3). It happens that my biogeographic application is due to official release in three days and it makes use of some critical functionality that is available only in the lastest Basemap version. Anyway, the online documentation for Basemap already indicates that the current version is 0.99.3 (but the .exe files in the SF repository are still from version 0.99.2). With warmest regards, 2009/1/10 Jeff Whitaker <jsw...@fastmail.fm>: > Mauro Cavalcanti wrote: >> >> Dear Jeff & ALL, >> >> How can I get rid, programmatically, of lines drawn with the >> drawparallels and drawmeridians in MPL/Basemap? These methods return >> dictionaries, but calling the Python clear() method for dictionaries >> (and redrawing the figure as usual, of course) does not work. No error >> appears, simply nothing happens. >> >> Any hints? >> >> Thanks in advance! >> >> Best regards, >> >> > > Mauro: From the docstring > > "returns a dictionary whose keys are the parallel values, and whose values > are tuples containing lists of the matplotlib.lines.Line2D and > matplotlib.text.Text instances associated with each parallel." > > So, if "pd" is the dict returned by drawparallels, pd[30] would be a tuple > of lists of Line2D and Text instances associated with the 30 degree > parallel. You can call the remove() method on each of the items in those > lists to remove them from the plot. > > For example, > > [jsws-MacBook:~] jwhitaker% ipython2.5 -pylab > Python 2.5.4 (r254:67916, Jan 9 2009, 07:06:45) > Type "copyright", "credits" or "license" for more information. > > IPython 0.9.1 -- An enhanced Interactive Python. > ? -> Introduction and overview of IPython's features. > %quickref -> Quick reference. > help -> Python's own help system. > object? -> Details about 'object'. ?object also works, ?? prints more. > > Welcome to pylab, a matplotlib-based Python environment. > For more information, type 'help(pylab)'. > > In [1]: from mpl_toolkits.basemap import Basemap > > In [2]: m = Basemap() > In [9]: pd=m.drawparallels(range(0,90,30),labels=[1,0,0,0]) > > In [10]: pd > > Out[10]: > {0: ([<matplotlib.lines.Line2D object at 0x17ea2bd0>], > [<matplotlib.text.Text object at 0x17eab1f0>]), > 30: ([<matplotlib.lines.Line2D object at 0x17ea2d30>], > [<matplotlib.text.Text object at 0x17eab270>]), > 60: ([<matplotlib.lines.Line2D object at 0x17ea2f30>], > [<matplotlib.text.Text object at 0x17eab2f0>])} > > In [11]: pd[30] > > Out[11]: > ([<matplotlib.lines.Line2D object at 0x17ea2d30>], > [<matplotlib.text.Text object at 0x17eab270>]) > > In [12]: pd[30][0][0] > > Out[12]: <matplotlib.lines.Line2D object at 0x17ea2d30> > > In [13]: pd[30][0][0].remove() > > > > HTH, -Jeff > -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: mauro...@gmail.com Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 "Life is complex. It consists of real and imaginary parts." ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users