我遇到了一个微不足道的问题,那就是如何在极地图中将误差条设为径向。下面是我的代码:
#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°。我刚刚注意到误差条的厚度与它们到中心的距离成正比,这是不应该的。

我见过使用transform=Affine2D().rotate_deg(90)的this attempt来旋转标记,但它不符合我的语法。
PS。有没有可能径向移动角度的标签,这样它们就不会与图形重叠?
谢谢你的帮助!
发布于 2021-10-09 09:58:41
答案是惊人的微不足道:yerr的绝对值非常小,参数lw = 20表示条形的宽度。修正后的版本类似于:
plt.errorbar(phi_mol1D/180.*np.pi, MFPAD, yerr=MFPADerr*10, mec='green', fmt="o", color="b", ms=5) 这将返回以下内容:

如果有人知道如何径向移动学位标签,那就太棒了。我为这篇无用的帖子道歉。
https://stackoverflow.com/questions/69497772
复制相似问题