属性配置

查找配置文件

使用命令查找配置文件

>>> import matplotlib
>>> matplotlib.matplotlib_fname()
'xxx/xxx/matplotlib/mpl-data/matplotlibrc'

重载配置文件

修改完成配置文件后需要重新加载,或者重启系统,或者输入以下命令

from matplotlib.font_manager import _rebuild
_rebuild()

属性查找

使用命令查看当前属性

>>> import matplotlib.pyplot as plt
>>> plt.rcParams
/home/zj/software/anaconda/anaconda3/lib/python3.7/site-packages/matplotlib/__init__.py:886: MatplotlibDeprecationWarning: 
examples.directory is deprecated; in the future, examples will be found relative to the 'datapath' directory.
  "found relative to the 'datapath' directory.".format(key))
RcParams({'_internal.classic_mode': False,
          'agg.path.chunksize': 0,
          'animation.avconv_args': [],
          'animation.avconv_path': 'avconv',
          'animation.bitrate': -1,
          'animation.codec': 'h264',
          'animation.convert_args': [],
          'animation.convert_path': 'convert',
          'animation.embed_limit': 20.0,
          'animation.ffmpeg_args': [],
          'animation.ffmpeg_path': 'ffmpeg',
          'animation.frame_format': 'png',
          'animation.html': 'none',
          ...
          ...

属性设置

使用命令进行属性设置

plt.rcParams[xxx] = xxx