How to modify the font size of the axis in Python matplotlib.pyplot

Asked

Viewed 3,658 times

3

Good afternoon. I would like to know how I can increase the font on the axes when I plot a graph using matplotlib.pyplot.

inserir a descrição da imagem aqui

2 answers

1

plt.rcParams['xtick.labelsize'] = 16
plt.rcParams['ytick.labelsize'] = 16

1

Importing the library as

import matplotlib.pyplot as plt

To change the font on the chart axes, type before your Plot

plt.rcParams['xtick.labelsize'] = 20
plt.rcParams['ytick.labelsize'] = 20

to change the font size parameters on each of the axes. In place of 20 put the size you prefer.

If you want to change the font size of the caption as a whole, write before your Plot

plt.rcParams.update({'font.size': 20})

If you want to know more details, see https://matplotlib.org/users/customizing.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.