I tried to create a surface plot with Python 3 and now I am wondering why it is transparent? Any ideas? I expected it to look like the plot I created with MATLAB using the same data set
CodePudding user response:
Building on @kwinkunks and your attempt with shade
gets pretty close to what you're after. Note: I think LAT
, LON
were switched out of meshgrid
in kwinkunks answer.
h, w = ETOPO1.shape
lon = np.linspace( 30, 60, w)
lat = np.linspace(-20, 20, h)
LAT, LON = np.meshgrid(lon, lat)
fig, ax = plt.subplots(
figsize=(10, 10),
subplot_kw={"projection": "3d"})
ve = 100 # Approx. vertical exaggeration.
ax.set_box_aspect((1, 1, ve/1850))
ls = LightSource(270,45)
cs = ls.shade(
ETOPO1, cmap=cm.gist_earth,
vert_exag=ve/1850)
ax.plot_surface(
LON, LAT, ETOPO1,
rstride=5, cstride=5,
facecolors=cs)
ax.view_init(20, 15)