increase the size of matplotlib numbers

Asked

Viewed 751 times

0

How can I increase the size of graph numbers (those marked on x and y axes) in matplotlib? Similar to changing font size.

  • Well, the problem is explained. It’s simple. It doesn’t take so much detail. It’s a specific conceptual problem about matplotlib.

1 answer

3


Use the command plt.tick_params(labelsize=30) to increase the font size on the chart axes by replacing 30 by the desired size.

Example

from matplotlib import pyplot as plt
import math

# Dados de exemplo -- sen(x) calculado de 0 a 10
x = [v/10.0 for v in range(0, 100, 1)]
y = [math.sin(v) for v in x]

# Gráfico 1 - Tamanho da fonte normal
plt.plot(x, y)
plt.show()

# A próxima linha é responsável por aumentar o tamanho da fonte nos eixos
plt.tick_params(labelsize=30)

# Gráfico 2 - Tamanho da fonte aumentado
plt.plot(x, y)
plt.show()

Upshot

  • 1st chart with normal font size
  • 2nd graph with increased font size

inserir a descrição da imagem aqui

Browser other questions tagged

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