【发布时间】:2019-07-10 17:12:40
【问题描述】:
我没有得到任何错误,但直方图没有意义。条形图根本不居中。这里是:
]1
前段时间我在做类似的事情,但直方图几乎是正确的。从那以后情况变得更糟了。这里是:
]2
我尝试过使用 ''width''、''bottom'' 和 ''align'' 但没有解决任何问题。
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
Theta = np.linspace(0.0, 2.0*np.pi, 12)
Dim = [2.31330, 2.32173, 2.32841, 2.32068, 2.31452, 2.30792, 2.31313, 2.31847, 2.31910, 2.31516, 2.30617, 2.30408]
width = (2*np.pi) / 13
ax1 = plt.subplot(111, polar=True)
bars = ax1.bar(Theta, Dim, color='b', width=width, bottom = 0.0, edgecolor = 'k', align = 'edge')
ax1.set_ylim(2.31000, 2.33000)
ax1.set_yticks(np.linspace(2.31000, 2.33000, 5))
ax1.set_rlabel_position(180)
ax1.set_theta_zero_location("N")
ax1.set_theta_direction(-1)
plt.show()
基本上我只需要条形在 0.0 处相遇并且看起来像条形,而不是这个。不管这是什么。
【问题讨论】:
标签: python matplotlib histogram python-3.6 polar-coordinates