本文整理汇总了Python中matplotlib.toolkits.basemap.Basemap.pcolor方法的典型用法代码示例。如果您正苦于以下问题:Python Basemap.pcolor方法的具体用法?Python Basemap.pcolor怎么用?Python Basemap.pcolor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.toolkits.basemap.Basemap
的用法示例。
在下文中一共展示了Basemap.pcolor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Basemap
# 需要导入模块: from matplotlib.toolkits.basemap import Basemap [as 别名]
# 或者: from matplotlib.toolkits.basemap.Basemap import pcolor [as 别名]
tlon = N.concatenate((tlon,tlon+360),1)
tlat = N.concatenate((tlat,tlat),1)
temp = MA.concatenate((temp,temp),1)
tlon = tlon-360.
pl.figure(figsize=(8.5,11))
pl.subplot(2,1,1)
# subplot 1 just shows POP grid cells.
map = Basemap(projection='merc', lat_ts=20, llcrnrlon=-180, \
urcrnrlon=180, llcrnrlat=-84, urcrnrlat=84, resolution='c')
map.drawcoastlines()
map.fillcontinents(color='white')
x, y = map(tlon,tlat)
im = map.pcolor(x,y,MA.masked_array(N.zeros(temp.shape,'f'), temp.mask),\
shading='faceted',cmap=pl.cm.cool,vmin=0,vmax=0)
# disclaimer: these are not really the grid cells because of the
# way pcolor interprets the x and y args.
pl.title('(A) CCSM POP Grid Cells')
# subplot 2 is a contour plot of surface temperature from the
# CCSM ocean model.
pl.subplot(2,1,2)
map.drawcoastlines()
map.fillcontinents(color='white')
CS1 = map.contourf(x,y,temp,15)
CS2 = map.contour(x,y,temp,15,colors='black',linewidths=0.5)
pl.title('(B) Surface Temp contours on POP Grid')
pl.show()
示例2: meshgrid
# 需要导入模块: from matplotlib.toolkits.basemap import Basemap [as 别名]
# 或者: from matplotlib.toolkits.basemap.Basemap import pcolor [as 别名]
lats[-1] = latsin[-1]+0.5*delon
lons, lats = meshgrid(lons, lats)
# setup of basemap ('lcc' = lambert conformal conic).
# use major and minor sphere radii from WGS84 ellipsoid.
m = Basemap(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
resolution='l',area_thresh=1000.,projection='lcc',\
lat_1=50.,lon_0=-107.)
fig=m.createfigure()
ax = fig.add_axes([0.1,0.1,0.7,0.7],axisbg='aqua')
# make topodat a masked array, masking values lower than sea level.
topodat = where(topoin < 0.,1.e10,topoin)
topodat = ma.masked_values(topodat, 1.e10)
# make a pcolor plot.
x, y = m(lons, lats)
p = m.pcolor(x,y,topodat,shading='flat',cmap=cm.jet)
clim(-4000.,3000.) # adjust colormap.
cax = axes([0.875, 0.1, 0.05, 0.7]) # setup colorbar axes
colorbar(tickfmt='%d', cax=cax) # draw colorbar
axes(ax) # make the original axes current again
# plot blue dot on boulder, colorado and label it as such.
xpt,ypt = m(-104.237,40.125)
m.plot([xpt],[ypt],'bo')
text(xpt+100000,ypt+100000,'Boulder')
# draw coastlines and political boundaries.
m.drawcoastlines()
#m.drawcountries()
#m.drawstates()
# draw parallels and meridians.
# label on left, right and bottom of map.
parallels = arange(0.,80,20.)
示例3: figure
# 需要导入模块: from matplotlib.toolkits.basemap import Basemap [as 别名]
# 或者: from matplotlib.toolkits.basemap.Basemap import pcolor [as 别名]
hgt,x,y = m.transform_scalar(hgt,lons,lats,nx,ny,returnxy=True)
fig = figure(figsize=(8,8))
plots = ['contour','pcolor']
#plots = ['contour','imshow']
for np,plot in enumerate(plots):
fig.add_subplot(1,2,np+1)
ax = gca()
# plot data.
print plot+' plot ...'
if plot == 'pcolor':
m.pcolor(x,y,hgt,shading='flat')
elif plot == 'imshow':
im = m.imshow(hgt)
elif plot == 'contour':
levels, colls = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
levels, colls = m.contourf(x,y,hgt,15,cmap=cm.jet,colors=None)
# set size of plot to match aspect ratio of map.
l,b,w,h = ax.get_position()
b = 0.5 - 0.5*w*m.aspect; h = w*m.aspect
ax.set_position([l,b,w,h])
# draw map.
m.drawcoastlines()
# draw parallels