Skip to content

Commit 6335852

Browse files
committed
update example for latest numpy and matplotlib
1 parent 2024d05 commit 6335852

9 files changed

+10
-10
lines changed

examples/ccsm_popgrid.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
m.fillcontinents(color='white')
5757

5858
x, y = m(tlon,tlat)
59-
im = m.pcolor(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask),
59+
im = m.pcolormesh(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask),
6060
shading='faceted', antialiased=True, cmap=plt.cm.cool,
6161
vmin=0, vmax=0)
6262
# disclaimer: these are not really the grid cells because of the

examples/counties.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from mpl_toolkits.basemap import Basemap
33

44
def draw_map_background(m, ax):
5-
ax.set_axis_bgcolor('#729FCF')
5+
ax.set_facecolor('#729FCF')
66
m.fillcontinents(color='#FAFAFA', ax=ax, zorder=0)
77
m.drawcounties(ax=ax)
88
m.drawstates(ax=ax)

examples/geos_demo_3.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
lon_0=57
77
# global geos map
88
m1 = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution=None)
9-
ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='k')
9+
ax = fig.add_axes([0.1,0.1,0.8,0.8], facecolor='k')
1010
# plot just upper right quadrant (coordinates determined from global map).
1111
m = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution='l',llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.)
1212
m.drawcoastlines()
@@ -22,7 +22,7 @@
2222
# global ortho map
2323
lat_0=10.
2424
m1 = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution=None)
25-
ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='k')
25+
ax = fig.add_axes([0.1,0.1,0.8,0.8], facecolor='k')
2626
# plot just upper right quadrant (corners determined from global map).
2727
m = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution='l',llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.)
2828
m.drawcoastlines()

examples/hexbin_demo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
H = np.ma.masked_where(mask, H/bincount)
5555
# set color of masked values to axes background (hexbin does this by default)
5656
palette = plt.cm.jet
57-
palette.set_bad(ax.get_axis_bgcolor(), 1.0)
57+
palette.set_bad(ax.get_facecolor(), 1.0)
5858
CS = m.pcolormesh(xedges,yedges,H.T,shading='flat',cmap=palette)
5959
# draw coastlines, lat/lon lines.
6060
m.drawcoastlines()

examples/nsper_demo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def get_input(prompt):
3232

3333
fig = plt.figure()
3434
m1 = Basemap(projection='nsper',lon_0=lon_0,lat_0=lat_0,satellite_height=h,resolution=None)
35-
ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='k')
35+
ax = fig.add_axes([0.1,0.1,0.8,0.8], facecolor='k')
3636
# plot just upper right quadrant (coordinates determined from global map).
3737
m = Basemap(projection='nsper',lon_0=lon_0,lat_0=lat_0,satellite_height=h,resolution='l',llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.)
3838
m.drawcoastlines()

examples/plotozone.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
# add an axes.
5050
ax = fig.add_axes([0.1,0.1,0.8,0.8])
51-
ax.set_axis_bgcolor('lightgrey')
51+
ax.set_facecolor('lightgrey')
5252
# associate this axes with the Basemap instance.
5353
m.ax = ax
5454

examples/streamplot_demo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
m.drawmeridians(np.arange(-120,-60,2),labels=[0,0,0,1])
3838
m.drawparallels(np.arange(0,30,2),labels=[1,0,0,0])
3939

40-
m.streamplot(x,y,udat,vdat,color=speed,linewidth=2,density=2,cmap=plt.cm.spectral)
40+
m.streamplot(x,y,udat,vdat,color=speed,linewidth=2,density=2,cmap=plt.cm.Spectral)
4141
m.colorbar()
4242

4343
plt.title('Hurricane Rita flow field visualized with streamlines',\

examples/test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@
377377
llcrnrx = 137, urcrnrx = 222.5, resolution = 'l')
378378
m.drawcoastlines()
379379
ny,nx = lons.shape
380-
m.contourf(lons[ny/2:,:],lats[ny/2:,:],topodat[ny/2:,:],50,cmap=cmap,extend='both',latlon=True)
380+
m.contourf(lons[ny//2:,:],lats[ny//2:,:],topodat[ny//2:,:],50,cmap=cmap,extend='both',latlon=True)
381381
m.drawmeridians(np.arange(-180,180,20),labels=[1,1,1,1])
382382
m.drawparallels(np.arange(20,80,20))
383383
m.colorbar()

examples/testarcgis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
epsg = 2263; width=600.e3; height = 400.e3
2929
m=Basemap(epsg=epsg,resolution='h',width=width,height=height)
3030
# specify a different server.
31-
m.arcgisimage(server='http://maps.ngdc.noaa.gov',service='etopo1',verbose=True)
31+
m.arcgisimage(server='https://gis.ngdc.noaa.gov/arcgis',service='etopo1',verbose=True)
3232
m.drawmeridians(np.arange(-180,180,2),labels=[0,0,0,1])
3333
m.drawparallels(np.arange(0,80,1),labels=[1,0,0,0])
3434
m.drawcoastlines(linewidth=0.25)

0 commit comments

Comments
 (0)