[英]Reorient Matplotlib polar plot
I would like to produce a polar scatterplot in matplotlib.我想在 matplotlib 中生成一个极坐标散点图。 The plot I have from using
ax1 = plt.subplot(111, polar=True)
looks fine, but I need to deviate from the usual polar graph orientation.我使用
ax1 = plt.subplot(111, polar=True)
的 plot 看起来不错,但我需要偏离通常的极坐标图方向。
(How) Can I do this? (我怎样才能做到这一点?
You need ax.set_theta_zero_location
and ax.set_theta_direction
.您需要
ax.set_theta_zero_location
和ax.set_theta_direction
。 For details, see the doc有关详细信息,请参阅文档
import matplotlib.pyplot as plt
import numpy as np
r = range(360)
angles = [i * np.pi / 180 for i in r]
f = plt.figure()
ax = plt.subplot(polar=True)
plt.polar(angles, r)
ax.set_xticks(angles[::10])
ax.set_theta_zero_location("N")
ax.set_theta_direction(-1)
plt.show()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.