如何为科学论文在 matplotlib 图中一致且轻松地更改字体、字体粗细、颜色图……?

How to change font, fontweight, colormap ... in matplotlib plots consistently and easily for scientific papers?

以下是迄今为止我发现的为所有地块一致设置这些参数的最方便的方法:

import matplotlib.pyplot as plt

plt.rcParams['image.cmap'] = 'jet'
plt.rcParams['font.family'] = 'Arial'
plt.rcParams['font.weight'] = 'bold

有没有更好的解决方案?

你可以试试这个

font = {'cmap' : 'jet',
        'weight' : 'bold',
        'family'   : 'Arial'}

plt.rcParams('font', **font)

更多详情可以参考https://matplotlib.org/api/matplotlib_configuration_api.html#matplotlib.rc