Sometimes, we want to change the font size on a matplotlib plot with Python.
In this article, we’ll look at how to change the font size on a matplotlib plot with Python.
How to change the font size on a matplotlib plot with Python?
To change the font size on a matplotlib plot with Python, we can use the matplotlib.rc
method.
For instance, we write
font = {'family' : 'normal',
'weight' : 'bold',
'size' : 22}
matplotlib.rc('font', **font)
to call rc
with the font
dict’s entries as arguments.
We use **
to unpack the entries as named arguments to set the family
, weight
, and size
argument values.
Conclusion
To change the font size on a matplotlib plot with Python, we can use the matplotlib.rc
method.