Dear Ryan,
Thank your very much for your kind reply. I had already a couple of
solutions to that problem, and your adds nicely to them!
I am very grateful to everyone who have been so helpful and can assure
you will also be formally acknowledged at the conclusion of this
project.
With warmest regards,
2008/12/1 Ryan May <rm...@gm...>:
> Mauro Cavalcanti wrote:
>>
>> Dear ALL,
>>
>> Is there any example of toggling points on and off a MPL Basemap? I
>> see that there matplotlib artists have a handy "set_visible()" method,
>> but if I have a map with plotted points and use
>> "ax.set_visible(False)", the entire map is made invisible!
>
> Sorry this took so long, I lost you in my queue.
>
> You need to first save the results of the command you use to plot the points
> (every plotting command returns an object or set of objects that represent
> what was added to the plot.). You then call set_visible() on this object.
> Your problem was that calling ax.set_visible(False) made the entire Axes
> object invisible, which, as you saw, hid the plot. Here's a modified version
> of the plotcities example:
>
>
> from mpl_toolkits.basemap import Basemap as Basemap
>
> m = Basemap()
> x, y = [70,30,110,-97,75,-10], [35, 40, 45, 60, -10, -40]
> x,y = m(x,y)
> m.drawcoastlines()
> m.fillcontinents()
> pts = m.scatter(x,y,25,marker='o',edgecolors='none',zorder=10)
> pts.set_visible(False) #Uncomment to make visible
> plt.show()
>
> Hope this helps,
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
>
--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: mau...@gm...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."
|