From: <js...@us...> - 2008-05-30 20:26:10
|
Revision: 5337 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5337&view=rev Author: jswhit Date: 2008-05-30 13:25:57 -0700 (Fri, 30 May 2008) Log Message: ----------- convert to plt/np namespace, fix Basemap import for version 0.99 (mpl_toolkits) Modified Paths: -------------- trunk/py4science/examples/basemap1.py trunk/py4science/examples/basemap2.py trunk/py4science/examples/basemap3.py trunk/py4science/examples/basemap4.py trunk/py4science/examples/basemap5.py Modified: trunk/py4science/examples/basemap1.py =================================================================== --- trunk/py4science/examples/basemap1.py 2008-05-30 20:05:57 UTC (rev 5336) +++ trunk/py4science/examples/basemap1.py 2008-05-30 20:25:57 UTC (rev 5337) @@ -1,5 +1,5 @@ -import pylab, numpy -from matplotlib.toolkits.basemap import Basemap +from mpl_toolkits.basemap import Basemap +import matplotlib.pyplot as plt # create map by specifying lat/lon values at corners. resolution = 'l'; projection = 'lcc' lat_0 = 60; lon_0 = -50 @@ -18,5 +18,5 @@ # draw states and countries. m.drawcountries() m.drawstates() -pylab.title('map region specified using corner lat/lon values') -pylab.show() +plt.title('map region specified using corner lat/lon values') +plt.show() Modified: trunk/py4science/examples/basemap2.py =================================================================== --- trunk/py4science/examples/basemap2.py 2008-05-30 20:05:57 UTC (rev 5336) +++ trunk/py4science/examples/basemap2.py 2008-05-30 20:25:57 UTC (rev 5337) @@ -1,5 +1,5 @@ -import pylab, numpy -from matplotlib.toolkits.basemap import Basemap +from mpl_toolkits.basemap import Basemap +import matplotlib.pyplot as plt # create map by specifying width and height in km. resolution = 'l'; projection = 'lcc' lon_0 = -50; lat_0 = 60 @@ -12,5 +12,5 @@ m.fillcontinents(color='coral',lake_color='aqua') m.drawcountries() m.drawstates() -pylab.title('map region specified using width and height') -pylab.show() +plt.title('map region specified using width and height') +plt.show() Modified: trunk/py4science/examples/basemap3.py =================================================================== --- trunk/py4science/examples/basemap3.py 2008-05-30 20:05:57 UTC (rev 5336) +++ trunk/py4science/examples/basemap3.py 2008-05-30 20:25:57 UTC (rev 5337) @@ -1,5 +1,5 @@ -import pylab, numpy -from matplotlib.toolkits.basemap import Basemap +from mpl_toolkits.basemap import Basemap +import matplotlib.pyplot as plt # create map by specifying width and height in km. resolution = 'l'; projection = 'lcc' lon_0 = -50; lat_0 = 60 @@ -23,14 +23,14 @@ m.drawgreatcircle(nylon,nylat,lonlon,lonlat,linewidth=2,color='k') # put the names of the cities to the left of each dot, offset # by a little. Use a bold font. -pylab.text(ny_x-100000,ny_y+100000,'New York',fontsize=12,\ +plt.text(ny_x-100000,ny_y+100000,'New York',fontsize=12,\ color='k',horizontalalignment='right',fontweight='bold') -pylab.text(lon_x-100000,lon_y+100000,'London',fontsize=12,\ +plt.text(lon_x-100000,lon_y+100000,'London',fontsize=12,\ color='k',horizontalalignment='right',fontweight='bold') m.drawcoastlines(linewidth=0.5) m.drawmapboundary(fill_color='aqua') m.fillcontinents(color='coral',lake_color='aqua') m.drawcountries() m.drawstates() -pylab.title('NY to London Great Circle') -pylab.show() +plt.title('NY to London Great Circle') +plt.show() Modified: trunk/py4science/examples/basemap4.py =================================================================== --- trunk/py4science/examples/basemap4.py 2008-05-30 20:05:57 UTC (rev 5336) +++ trunk/py4science/examples/basemap4.py 2008-05-30 20:25:57 UTC (rev 5337) @@ -1,5 +1,6 @@ -import pylab, numpy -from matplotlib.toolkits.basemap import Basemap +from mpl_toolkits.basemap import Basemap +import matplotlib.pyplot as plt +import numpy as np # create map by specifying width and height in km. resolution = 'l' lon_0 = -50 @@ -16,9 +17,9 @@ m.drawstates() # label meridians where they intersect the left, right and bottom # of the plot frame. -m.drawmeridians(numpy.arange(-180,181,20),labels=[1,1,0,1]) +m.drawmeridians(np.arange(-180,181,20),labels=[1,1,0,1]) # label parallels where they intersect the left, right and top # of the plot frame. -m.drawparallels(numpy.arange(-80,81,20),labels=[1,1,1,0]) -pylab.title('labelled meridians and parallels',y=1.075) -pylab.show() +m.drawparallels(np.arange(-80,81,20),labels=[1,1,1,0]) +plt.title('labelled meridians and parallels',y=1.075) +plt.show() Modified: trunk/py4science/examples/basemap5.py =================================================================== --- trunk/py4science/examples/basemap5.py 2008-05-30 20:05:57 UTC (rev 5336) +++ trunk/py4science/examples/basemap5.py 2008-05-30 20:25:57 UTC (rev 5337) @@ -1,5 +1,6 @@ -from matplotlib.toolkits.basemap import Basemap, NetCDFFile -import pylab, numpy +from mpl_toolkits.basemap import Basemap, NetCDFFile +import matplotlib.pyplot as plt +import numpy as np # read in netCDF sea-surface temperature data # can be a local file, a URL for a remote opendap dataset, # or (if PyNIO is installed) a GRIB or HDF file. @@ -12,15 +13,15 @@ # continent processing (this speeds things up a bit) m = Basemap(projection='moll',lon_0=0,lat_0=0,resolution=None) # compute map projection coordinates of grid. -x, y = m(*numpy.meshgrid(lons, lats)) +x, y = m(*np.meshgrid(lons, lats)) # plot with pcolor -im = m.pcolormesh(x,y,sst,shading='flat',cmap=pylab.cm.gist_ncar) +im = m.pcolormesh(x,y,sst,shading='flat',cmap=plt.cm.gist_ncar) # draw parallels and meridians, but don't bother labelling them. -m.drawparallels(numpy.arange(-90.,120.,30.)) -m.drawmeridians(numpy.arange(0.,420.,60.)) +m.drawparallels(np.arange(-90.,120.,30.)) +m.drawmeridians(np.arange(0.,420.,60.)) # draw line around map projection limb. # color map region background black (missing values will be this color) m.drawmapboundary(fill_color='k') # draw horizontal colorbar. -pylab.colorbar(orientation='horizontal') -pylab.show() +plt.colorbar(orientation='horizontal') +plt.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |