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
  • 108,021
  • 142
  • 552
  • 849
Orso Pusterla
  • 23
  • 1
  • 2
  • 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
  • 11,926
  • 7
  • 81
  • 121
  • 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
  • you like to speak... bla bla bla... This was a specific request: sound and clear! No answer to my problem are/were present in stackoverflow. New member cannot post pictures. If you like I can send you the entire code. Thanks anyway for your precious advice @Adobe! – Orso Pusterla Aug 21 '14 at 22:32