Jim Vickroy wrote: > Hello users, > > I'm using matplotlib.toolkits.basemap.Basemap to plot data on several > types of projections at a regular cadence. I am presently regenerating > the maps each time new data is to be plotted. Is it possible to > generate template map projections once (at startup) and reuse them each > time new data is to be plotted? If so, could someone point to a > reference or example of how to do this? > > Thanks, > -- jv >
Jim: You can reuse a Basemap instance to plot data on multiple figures, like this # create the first figure fig = pylab.figure() # create a Basemap instance for your map projection map = Basemap(...) # plot some stuff on this map projection. map.contour(...) ... some other plotting commands ... # save the figure pylab.savefig('plot1.png') # create another figure fig = pylab.figure() # use the same basemap instance to different data on this map projection map.contour(...) ... more plotting commands... # save the second figure pylab.savefig('plot2.png') You can also save the Basemap instance to disk using the Pickle module and reload it in another script. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : [EMAIL PROTECTED] 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users