2016-09-28 77 views
0

在一些(相當小)使用polar=True的數字中,ticklabels與軸重疊。例如:偏軸matplotlib`ticklabels`從軸

import numpy as np 
import matplotlib.pylab as pl 

fig = pl.figure(figsize=[2,2]) 
fig.subplots_adjust(0.2, 0.2, 0.8, 0.8) 
ax = pl.subplot(111, polar=True) 
ax.set_yticks([]) 

創建:

enter image description here

是否有可能設置軸和標籤之間,即偏移移動180位到左側,0到右側,等等?我更喜歡根據subplot來設置它,因爲我在其他subplots在同一圖中不需要ticklabel抵消。

+2

請參閱[添加填充/偏移到極座標刻度標籤](http://stackoverflow.com/questions/17159668/matplotlib-adding-padding-offset-to-polar-plots-tick-labels)。這回答了你的問題了嗎? – nostradamus

+0

是的,這完全回答了我的問題,沒有看到那個。我投票結束我的問題作爲一個重複... – Bart

回答

0

您正在尋找PolarAxes類,它的set_thetagrids方法 - 除了允許你定義的θ的屬性座標網格 - 可以通過縮放frac參數設置徑向刻度標記的偏移。有關更多信息,請參閱docs。下面是修改後的示例相同的字體和大小人物:

import numpy as np 
import matplotlib.pylab as pl 

fig = pl.figure(figsize=[2,2]) 
fig.subplots_adjust(0.2, 0.2, 0.8, 0.8) 
ax = pl.subplot(111, polar=True) 

# if you want to preserve the old tick degrees 
old_ticks = ax.xaxis.get_ticklocs()/np.pi * 180 
ax.set_thetagrids(old_ticks, frac=1.3) 
ax.set_yticks([]) 
pl.show() 

polar ticks

編輯:由@nostradamus在OP註釋部分鏈接的answer比我自己更詳細。我建議看看它。

+0

是的,我同意,沒有看到這個問題,它完全回答了我的問題。 – Bart