Is there a way to turn of xticks and yticks using matplotlibrc or another matplotlib config method? The only way I see currently is to set the sizes of ticks and tick labels to zero. That seems an odd way, given that I can set_xticks(())
Asked
Active
Viewed 450 times
1

Andreas Mueller
- 27,470
- 8
- 62
- 74
-
1http://stackoverflow.com/questions/12998430/remove-xticks-in-a-matplot-lib-plot – RyanL Jan 27 '16 at 18:23
1 Answers
2
You can do this with tick_params
plt.tick_params(axis='both', which='both')
This is affecting both
axis (other options are x
or y
). It also affects both
major and minor ticks (other options are major
or minor
)
This will leave ticks around the outer edge, but not in the plot. If you want the edge ticks removed, you can add:
bottom='off'
top='off'
left='off'
right='off'
If you want to remove the labels, you'll want to turn these off
labelbottom='off'
labeltop='off'
labelleft='off'
labelright='off'

Andy
- 49,085
- 60
- 166
- 233
-
That's great! It seems like a very long command to turn off ticks but it seems to work. It seems to work persistently, but I can't see that mentioned in the docs. – Andreas Mueller Jan 27 '16 at 18:33