Jeff Whitaker wrote:
> 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
>
>
Thanks for the detailed explanation; I may be starting to understand the 
significance of *figure*.

I was hoping to avoid repeated calls like map.drawcoastlines(), 
map.drawcountries(), map.fillcontinents(color='0.95'), 
map.drawmapboundary(), map.drawmeridians(plot.arange(0,360,30)), and 
map.drawparallels(plot.arange(-90,90,30)).  So, I will follow your 
example and experiment to see what works and what does not to better 
understand the behaviors.

-- jv


-------------------------------------------------------------------------
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

Reply via email to