8

I set matplotlib to put ticks outside the plot area but now they overlap on the corresponding labels. the tick_params method does not provide any option to set the corresponding labels position. So I guess I will have to write my own function using text() method. In the meanwhile does any one has a better suggestion?

user1850133
  • 2,833
  • 9
  • 29
  • 39

1 Answers1

11

To shift the tick labels relative to the ticks use pad. Compare

ax.tick_params(direction='out', pad=5)
plt.draw()

with

ax.tick_params(direction='out', pad=15)
plt.draw()
tacaswell
  • 84,579
  • 22
  • 210
  • 199
  • @user1850133 no worries. One could argue it should have been a separate question anyway (someone looking for how to adjust the padding would not look at how to flip the ticks). – tacaswell Feb 10 '13 at 20:59
  • I said sorry because I said "the tick_params method does not provide any option to set the corresponding labels position" while it's not true and I nevertheless checked the documentation but it seems carelessly. – user1850133 Feb 17 '13 at 18:53
  • How can we pad in the other direction? (i.e. I want to offset the ticks' label to the right, because my labels are rotated and dont appear under the right bar ) – c-a Mar 14 '14 at 16:46
  • @c-a I assume negative values. You should open a new question rather than asking in the comments of a year old question. – tacaswell Mar 14 '14 at 16:48