2016-09-28 76 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