您可以使用plot.legend(loc=2, prop={'size': 6}) 来增加图例大小这需要与matplotlib.font_manager.FontProperties 属性对应的关键字字典。 more about legends
1)。如果您想根据 x 值增加绘图数据的大小,这将很有帮助。
# yvalues is the y value list
widthscale = len(yvalues)/4
figsize = (8*widthscale,6) # fig size in inches (width,height)
figure = pylab.figure(figsize = figsize) # set the figsize
如果你想在没有动态的情况下增加它们,你可以使用plot.rc 函数
例如。
import matplotlib.pyplot as plt
SMALL_SIZE = 8
MEDIUM_SIZE = 10
BIGGER_SIZE = 12
plt.rc('font', size=SMALL_SIZE) # controls default text sizes
plt.rc('axes', titlesize=SMALL_SIZE) # fontsize of the axes title
plt.rc('axes', labelsize=MEDIUM_SIZE) # fontsize of the x and y labels
plt.rc('xtick', labelsize=SMALL_SIZE) # fontsize of the tick labels
plt.rc('ytick', labelsize=SMALL_SIZE) # fontsize of the tick labels
plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize
plt.rc('figure', titlesize=BIGGER_SIZE) # fontsize of the figure title
2).第二个选项是
plt.rcParams["axes.labelsize"] = 22
或者直接控制标签的大小
ax.set_xlabel("some label", fontsize=22)
要控制图例的字体大小,您可以使用 rcParams
plt.rcParams["legend.fontsize"] = 22
或者直接在图例中指定大小
ax.legend(fontsize=22)