新入门找的一段代码求讲解
四季酒店 2019-01-20 06:42:02 # This import registers the 3D projection, but is otherwise unused.
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
from matplotlib import cbook
from matplotlib import cm
from matplotlib.colors import LightSource
import matplotlib.pyplot as plt
import numpy as np
# Load and format data
filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False)
with np.load(filename) as dem:
z = dem['elevation']
nrows, ncols = z.shape
x = np.linspace(dem['xmin'], dem['xmax'], ncols)
y = np.linspace(dem['ymin'], dem['ymax'], nrows)
x, y = np.meshgrid(x, y)
region = np.s_[5:50, 5:50]
x, y, z = x[region], y[region], z[region]
plt.show()
主要是loda data这段, dem['elevation'] ,dem['xmin'], dem['xmax'],对应的txt应该是什么样的?想看一下效果。
还有region = np.s_[5:50, 5:50]和cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False)是什么意思,求大神讲解一下,谢谢