简体   繁体   English

Python 极坐标图问题

[英]Python Polar Plot Issue

My data ends at around 23 hours but it keeps looping like the image shown below:我的数据在大约 23 小时后结束,但它一直循环,如下图所示: 在此处输入图片说明

Code:代码:

ax = plt.subplot(111, projection='polar')
ax.plot(x,y)

ax.set_theta_direction(-1)
ax.set_theta_offset(pi/2.0)
ax.set_xticks(np.linspace(0, 2*pi, 24, endpoint=False))
ax.set_xticklabels(range(24))
ax.set_yticks((0.300,0.350,0.400,0.450,0.500,0.550,0.600))
ax.set_ylim([0.3,0.6])
ax.set_yticklabels(('300','350','400','450','500','550','600'))

plt.show()

Thanks谢谢

You have to transform your x-Axis defined in ax.plot to range from 0 to 2*PI.您必须将 ax.plot 中定义的 x 轴转换为 0 到 2*PI 的范围。 eg x[:] = x[:]/(2.*pi) before ax.plot例如 x[:] = x[:]/(2.*pi) 在 ax.plot 之前

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM