如何更改 matplotlib 中直方图中标题和数字的大小?
How to change the size of the title and the numbers in a histogram in matplotlib?
我想增加每个直方图标题的大小,同时增加轴上数字的大小。
axs = regiao_nota_MT['NU_NOTA_MT'].hist(by = regiao_nota_MT['Regiao'], figsize=(15, 10), facecolor='green', alpha=0.5)
for ax in axs.flatten():
ax.set_xlabel("NU_NOTA_MT", size = '13')
ax.set_ylabel("Number of students", size = '13')
您可以全局设置 axes.titles
和 ytick
的大小
import matplotlib.pyplot as plt
params = {'ytick.labelsize': 12,
'axes.titlesize': 12}
plt.rcParams.update(params)
我想增加每个直方图标题的大小,同时增加轴上数字的大小。
axs = regiao_nota_MT['NU_NOTA_MT'].hist(by = regiao_nota_MT['Regiao'], figsize=(15, 10), facecolor='green', alpha=0.5)
for ax in axs.flatten():
ax.set_xlabel("NU_NOTA_MT", size = '13')
ax.set_ylabel("Number of students", size = '13')
您可以全局设置 axes.titles
和 ytick
import matplotlib.pyplot as plt
params = {'ytick.labelsize': 12,
'axes.titlesize': 12}
plt.rcParams.update(params)