简体   繁体   中英

Python Polar Plot Issue

My data ends at around 23 hours but it keeps looping like the image shown below: 在此处输入图片说明

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. eg x[:] = x[:]/(2.*pi) before ax.plot

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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