Categories
Python Answers

How to make tick labels font size smaller with Python Matplotlib?

Spread the love

Sometimes, we want to make tick labels font size smaller with Python Matplotlib.

In this article, we’ll look at how to make tick labels font size smaller with Python Matplotlib.

How to make tick labels font size smaller with Python Matplotlib?

To make tick labels font size smaller with Python Matplotlib, we call tick_params with the labelsize argument.

For instance, we write

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

ax.tick_params(axis='both', which='major', labelsize=10)
ax.tick_params(axis='both', which='minor', labelsize=8)

to call tick_params with the labelsize argument set to the size of the labels on the axes.

Conclusion

To make tick labels font size smaller with Python Matplotlib, we call tick_params with the labelsize argument.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *