如何imshow()在3D轴上绘制图像?我正在尝试这篇文章.在那篇文章中,表面图看起来与imshow()情节相同,但实际上它们不是.为了演示,我在这里采用了不同的数据:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
# create a 21 x 21 vertex mesh
xx, yy = np.meshgrid(np.linspace(0,1,21), np.linspace(0,1,21))
# create vertices for a rotated mesh (3D rotation matrix)
X = xx
Y = yy
Z = 10*np.ones(X.shape)
# create some dummy data (20 x 20) for the image
data = np.cos(xx) * np.cos(xx) + np.sin(yy) * np.sin(yy)
# create the figure
fig = plt.figure()
# show …Run Code Online (Sandbox Code Playgroud)