matplotlib中有各种默认配置属性供画图使用。
matplotlib.rcParamas可在python中对matpoltlib中的各个配置属性进行修改,修改成功后,之后的绘图属性都按照新的属性来进行。
一. python代码中动态修改:
eg:
import matplotlib as mpl
## 设置字符集,防止中文乱码
mpl.rcParams['font.sans-serif']=[u'simHei']
mpl.rcParams['axes.unicode_minus']=False
#显示配置文件位置
print(mpl.matplotlib_fname())
二. 静态修改,在静态配置文件中修改:
mpl.matplotlib_fname()
三. 修改后恢复默认标准配置:
mpl.rcdefaults()
rc : Resource Configurations
更详细的配置属性说明,可参考:
http://blog.sina.com.cn/s/blog_7101508c01014igb.html
官方说明,可参考rcsetup接口:
https://matplotlib.org/2.2.2/api/rcsetup_api.html#module-matplotlib.rcsetup
https://matplotlib.org/api/matplotlib_configuration_api.html