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

问题描述

以下是迄今为止我找到的最方便的方法,可以为所有绘图一致地设置这些参数:

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