How do I change the font size of the scale in matplotlib plots?
matplotlib, python
Solution
Matplotlib refers to these as xtick labels. They can be changed in a large number of different ways, passed in as parameters, or iterated through and edited (as in the case of the solution posted here Matplotlib make tick labels font size smaller).
I went ahead and posted a more concise solution, as the former was very inefficient.
from matplotlib import pyplot
import math
def setLabelExample():
fig = pyplot.figure()
x = [i for i in range(200)]
y = [xi**2 for xi in x]
ax = fig.add_subplot(1,1,1)
ax.plot(x, y)
ax.tick_params(axis='x', labelsize=30)
fig.suptitle('Matplotlib xticklabels Example')
pyplot.show()
if __name__ == '__main__':
setLabelExample()
Problem
While plotting using Matplotlib, I have found how to change the font size of the labels. But, how can I change the size of the numbers in the scale? For clarity, suppose you plot x^2 from (x0,y0) = 0,0 to (x1,y1) = (20,20). The scale in the x-axis below maybe something like 0 1 2 ... 20. I want to change the font size of such scale of the x-axis.