Python 如何更改';r';matplotlib极坐标图的轴?

Python 如何更改';r';matplotlib极坐标图的轴?,python,matplotlib,plot,Python,Matplotlib,Plot,如何更改matplotlib极坐标图的“r”轴位置 我试图改变极坐标图中r轴的位置。 目前它被数据覆盖,但数据中存在θ=340-360度的间隙(在我的真实数据示例中,这实际上约为45度),因此如果我可以将轴标签放在数据间隙中,那就好了 import random import numpy as np import matplotlib.pyplot as plt sampleSize=1000 az=[] inc=[] for i in range(sampleSize): az.app

如何更改matplotlib极坐标图的“r”轴位置

我试图改变极坐标图中r轴的位置。 目前它被数据覆盖,但数据中存在θ=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()

我能想到的一种方法是使用
.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.)