【问题标题】:Reorient Matplotlib polar plot重新定向 Matplotlib 极坐标图
【发布时间】:2020-07-19 00:46:42
【问题描述】:

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

  1. 我需要 0 度才能指向正上方(旋转)。
  2. 我需要 90 度指向右侧(镜像)。

(如何)我可以这样做吗?

【问题讨论】:

    标签: python matplotlib plot scatter-plot polar-coordinates


    【解决方案1】:

    您需要ax.set_theta_zero_locationax.set_theta_direction。 详情见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()
    

    【讨论】:

      猜你喜欢
      • 2017-08-22
      • 2017-05-18
      • 1970-01-01
      • 2022-10-13
      • 1970-01-01
      • 2016-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多