极坐标图误差条 matplotlib

Polarplot errorbar maplotlib

我遇到了一个关于如何在极坐标图中制作误差条径向的小问题。这是我的代码:

#definition of the inerpolated red curve
tck = interpolate.splrep(phi_mol1D, MFPAD,s=0)
xnew = np.arange(-180, 180, 0.5)
ynew = interpolate.splev(xnew, tck)

fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
#plotting the red curve
plt.plot(xnew/180.*np.pi, ynew, c="r", alpha=0.5)
#error bars at each point
plt.errorbar(phi_mol1D/180.*np.pi, MFPAD, yerr=MFPADerr, mec='green', fmt="o", color="b", lw= 20, ms=5) 
#adjustments
ax.set_rticks([2000,4000,6000, 8000])
ax.set_yticklabels([])
ax.grid(True)

结果如下,其中误差线是切线的,即与我预期的相比旋转了 90°。我刚刚注意到误差线的厚度与它们到中心的距离成正比,这不应该。

我看到 this attempt 使用 transform=Affine2D().rotate_deg(90) 轮换制造商,但它不适用于我的语法。

PS。是否可以径向移动角度的标签,使其不与图形重叠?

感谢您的帮助!

答案非常简单:yerr 的绝对值非常小,参数 lw = 20 是条形的宽度。更正后的版本类似于:

plt.errorbar(phi_mol1D/180.*np.pi, MFPAD, yerr=MFPADerr*10, mec='green', fmt="o", color="b", ms=5) 

哪个returns这个:

如果有人知道如何径向移动度数标签,那就太棒了。对于没用的 post.

,我深表歉意