0

I have a plot where I set my ticks and labels manually, because pyplot did not do the job to my full satisfaction. I align the labels using the following code:

for tick in self.axes.xaxis.get_minorticklabels():
    tick.set_horizontalalignment('right')
    tick.set_rotation(40)

This is basically fine, but I'd like the labels to move a little bit further to the left (center is too far). I only found padding for the axis label in this post, but not for the tick labels. Is there something similar like labelpad=X to move the tick labels in horizontal direction?

s6hebern
  • 725
  • 9
  • 18

1 Answers1

0

You can use the Axes.set_tick_params() function to adjust the padding between the axe and the tick labels (minor, major, or both)

ax.xaxis.set_tick_params(which='minor', pad=25)
Diziet Asahi
  • 38,379
  • 7
  • 60
  • 75