0

In some (rather small) figures using polar=True, the ticklabels are overlapping with the axis. For example:

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([])

Creates:

enter image description here

Is it possible to set an offset between the axis and labels, i.e. move 180 a bit to the left, 0 to the right, et cetera? I prefer to set it per subplot, as I have some other subplots in the same figure which don't require the ticklabel offset.

Bart
  • 9,825
  • 5
  • 47
  • 73
  • 2
    See [adding padding/offset to polar plots tick labels](http://stackoverflow.com/questions/17159668/matplotlib-adding-padding-offset-to-polar-plots-tick-labels). Does this answer your question? – nostradamus Sep 28 '16 at 10:53
  • Yes, that perfectly answers my question, didn't see that one. I voted to close my question as a duplicate of that one... – Bart Sep 28 '16 at 11:12

1 Answers1

0

You're looking for a set_thetagrids method of PolarAxes class, which - aside from allowing you to define the properties of the theta coordinate grid - can set the radial offset of the tick labels by scaling the frac argument. See the docs for more info. Here's your modified example for the same font and figure sizes:

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

Edit: the answer linked by @nostradamus in the OP comment section is more detailed than my own. I recommend taking a look at it.

Community
  • 1
  • 1
Vlas Sokolov
  • 3,733
  • 3
  • 26
  • 43