2013-10-20 148 views
2

如何更改matplotlib極座標圖的'r'軸的位置?如何更改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() 

回答

4

一種方法是使用.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.) 

enter image description here