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

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to