繁体   English   中英

重新定向 Matplotlib 极性 plot

[英]Reorient Matplotlib polar plot

我想在 matplotlib 中生成一个极坐标散点图。 我使用ax1 = plt.subplot(111, polar=True)的 plot 看起来不错,但我需要偏离通常的极坐标图方向。

  1. 我需要 0 度来直指(旋转)。
  2. 我需要 90 度指向右侧(镜像)。

(我怎样才能做到这一点?

您需要ax.set_theta_zero_locationax.set_theta_direction 有关详细信息,请参阅文档

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.

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