如何从右到左设置matplotlib zaxis

时间:2019-01-30 03:03:54

标签: matplotlib

下面的代码生成3d直方图。现在,它的zaxia在右边,我想知道如何将它设置在左边。非常感谢!

data_2d = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
       [6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
       [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
       [16, 17, 18, 19, 20, 21, 22, 23, 24, 25],
       [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

x_data, y_data = np.meshgrid(np.arange(data_array.shape[1]),
                             np.arange(data_array.shape[0]))
x_data = x_data.flatten()
y_data = y_data.flatten()
z_data = data_array.flatten()
ax.bar3d(x_data,
         y_data,
         np.zeros(len(z_data)),
         1, 1, z_data)
plt.show()

enter image description here

0 个答案:

没有答案