【发布时间】:2013-08-06 02:49:22
【问题描述】:
我想为我的老板准备一些统计数据。 matplotlib 条形图的扁平风格会让那些习惯于 Excel 图表的人看起来很便宜,但为了清楚起见,可能应该避免使用这样的风格。
我不是那么远,但我不知道如何给出合适的钢筋厚度:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
row = [0, 0, 0, 22, 0, 0, 4, 16, 2, 0, 4, 4, 12, 26]
length = len(row)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = np.arange(length)
y = np.zeros(14)
z = np.array(row)
width = 0.8
ax.bar3d(x, y, [0]*length, 0.5, 0.001, z)
ax.set_xticks(x + width/2)
ax.set_xticklabels(titles[2:], rotation=90)
ax.set_yticks(y)
ax.set_zlabel('count')
plt.show()
结果:
【问题讨论】:
-
你试过什么?最近有一个关于酒吧气缸的问题。与 Excel 的好奇比较,我有完全相反的反应。
-
也许您可以使用this website 或this updated/additional information 中列出的步骤
-
Schorsch,谢谢,我去过那里,但代码显示非常不完整。 :(
-
网络说服我使用这毕竟不是一个好主意:例如 github.com/propublica/guides/blob/master/news-apps.md “不惜一切代价避免 3-D 图表。”
标签: python 3d matplotlib bar-chart