本文整理汇总了Python中matplotlib.cm.gist_earth方法的典型用法代码示例。如果您正苦于以下问题:Python cm.gist_earth方法的具体用法?Python cm.gist_earth怎么用?Python cm.gist_earth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.cm
的用法示例。
在下文中一共展示了cm.gist_earth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_light_source_topo_surface
# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import gist_earth [as 别名]
def test_light_source_topo_surface():
"""Shades a DEM using different v.e.'s and blend modes."""
fname = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False)
dem = np.load(fname)
elev = dem['elevation']
# Get the true cellsize in meters for accurate vertical exaggeration
# Convert from decimal degrees to meters
dx, dy = dem['dx'], dem['dy']
dx = 111320.0 * dx * np.cos(dem['ymin'])
dy = 111320.0 * dy
dem.close()
ls = mcolors.LightSource(315, 45)
cmap = cm.gist_earth
fig, axes = plt.subplots(nrows=3, ncols=3)
for row, mode in zip(axes, ['hsv', 'overlay', 'soft']):
for ax, ve in zip(row, [0.1, 1, 10]):
rgb = ls.shade(elev, cmap, vert_exag=ve, dx=dx, dy=dy,
blend_mode=mode)
ax.imshow(rgb)
ax.set(xticks=[], yticks=[])
示例2: ThrShow
# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import gist_earth [as 别名]
def ThrShow(self,data):
font1 = {'family' : 'STXihei',
'weight' : 'normal',
'size' : 50,
}
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'),figsize=(50,20))
ls = LightSource(data.shape[0], data.shape[1])
rgb = ls.shade(data, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft')
x=np.array([list(range(data.shape[0]))]*data.shape[1])
print(x.shape,x.T.shape,data.shape)
surf = ax.plot_surface(x, x.T, data, rstride=1, cstride=1, facecolors=rgb,linewidth=0, antialiased=False, shade=False,alpha=0.3)
fig.colorbar(surf,shrink=0.5,aspect=5)
cset = ax.contour(x, x.T, data, zdir='z', offset=37, cmap=cm.coolwarm)
cset = ax.contour(x, x.T, data, zdir='x', offset=-30, cmap=cm.coolwarm)
cset = ax.contour(x, x.T, data, zdir='y', offset=-30, cmap=cm.coolwarm)
plt.show()
示例3: createLatLonTimeAverageMap3d
# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import gist_earth [as 别名]
def createLatLonTimeAverageMap3d(res, meta, startTime=None, endTime=None):
latSeries = [m[0]['lat'] for m in res][::-1]
lonSeries = [m['lon'] for m in res[0]]
data = np.zeros((len(latSeries), len(lonSeries)))
for t in range(0, len(latSeries)):
latSet = res[t]
for l in range(0, len(lonSeries)):
data[len(latSeries) - t - 1][l] = latSet[l]['avg']
data[data == 0.0] = np.nan
x, y = np.meshgrid(latSeries, lonSeries)
z = data
region = np.s_[0:178, 0:178]
x, y, z = x[region], y[region], z[region]
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
ls = LightSource(270, 45)
masked_array = np.ma.array(z, mask=np.isnan(z))
rgb = ls.shade(masked_array, cmap=cm.gist_earth) # , vert_exag=0.1, blend_mode='soft')
surf = ax.plot_surface(x, y, masked_array, rstride=1, cstride=1, facecolors=rgb,
linewidth=0, antialiased=False, shade=False)
sio = StringIO()
plt.savefig(sio, format='png')
return sio.getvalue()