【问题标题】:How to change the location the 'r' axis for matplotlib polar plot?如何更改 matplotlib 极坐标图的“r”轴位置?
【发布时间】:2013-10-20 17:08:55
【问题描述】:

如何更改 matplotlib 极坐标图的 'r' 轴位置?

我正在尝试更改极坐标图中 r 轴的位置。 目前它被数据掩盖了,但是在 theta = 340-360 度的数据中存在一个差距(在我的真实数据示例中,这实际上是大约 45 度)所以如果我能放轴标签在那里,在数据间隙中。

import random
import numpy as np
import matplotlib.pyplot as plt
sampleSize=1000
az=[]
inc=[]
for i in range(sampleSize):
    az.append(random.randint(0,340)) #not to the full 360 to represent my natural gap in the data
    inc.append(random.randint(0,90))

plt.figure()
plt.polar(np.radians(az),inc,'o')
plt.show()

【问题讨论】:

    标签: python matplotlib plot


    【解决方案1】:

    我能想到的一种方法是使用.set_rgrids方法:

    f=plt.figure()
    ax = f.add_axes([0.1, 0.1, 0.8, 0.8], projection='polar')
    ax.plot(np.radians(az), inc, 'o')
    ax.set_rgrids([10,20,30,40,50,60,70,80,90], angle=345.)
    

    【讨论】:

      猜你喜欢
      • 2014-03-13
      • 2019-08-25
      • 2012-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-09
      相关资源
      最近更新 更多