我需要使用 python 的 Axes3D 绘制数据。这是我的代码:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
x = [74, 74, 74, 74, 74, 74, 74, 74, 192, 74]
y = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
z = [1455, 1219, 1240, 1338, 1276, 1298, 1292, 1157, 486, 1388]
dx = np.ones(10)
dy = np.ones(10)
dz = [0,1,2,3,4,5,6,7,8,9]
fig = plt.figure()
ax = Axes3D(fig)
ax.bar3d(x, y, z, dx, dy, dz, color='#00ceaa')
ax.w_xaxis.set_ticklabels(x)
ax.w_yaxis.set_ticklabels(y)
ax.set_title("Data Analysis ")
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
plt.show()
我的问题是我希望有一个看起来像直方图的大条。但我没有那个结果,这意味着它看起来像这样:
我必须在我的代码中更改什么才能获得像第二个数字这样的数字?
相关分类