0

As shown in the figure

by the arrows, I'd like to decrease the spacing between plot and xticks. Thanks in advance for the help.

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
Orso Pusterla
  • 23
  • 1
  • 3
  • See http://stackoverflow.com/questions/2969867/how-do-i-add-space-between-the-ticklabels-and-the-axes-in-matplotlib – tillsten Aug 21 '14 at 11:20
  • Take a look at http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.tick_params. The 'pad' parameter controls the spacing. – user3419537 Aug 21 '14 at 11:22

1 Answers1

4

Here are three ways to set the distance between ticklabels and the axis:

ax.tick_params(axis='x', pad=10)
ax.xaxis.labelpad = 10
plt.xlabel("your labels go here", labelpad=10)

And here's another one:

from matplotlib import rcParams
rcParams['xtick.major.pad']='8'
Adobe
  • 12,967
  • 10
  • 85
  • 126
  • Thanks a lot for the prompt and detailed reply. "ax.tick_params(axis='x', pad=10)" solved my issue. Best regards. – Orso Pusterla Aug 21 '14 at 12:10
  • @OrsoPusterla it'll be better if next time You'll include minimal working code reprodcing the problem at hand. You should also show You tried to solve the problem Youself. If You need to post picture You can post it directly at stackoverflow (there's picture button when You type in question). – Adobe Aug 21 '14 at 13:48