matplotlib 是一个开源项目,由 John Hunter 发起。关于 matplotlib 的由来,有一个小故事。John Hunter 和他研究癫痫症的同事借助一个专有软件做脑皮层电图分析,但是他所在的实验室只有一份该电图分析软件的许可。他和许多一起工作的同事不得不轮流使用该软件的硬件加密狗。于是,JohnHunter 便有了开发一个工具来替代当前所使用的软件的想法。当时MATLAB被广泛应用在生物医学界中,John Hunter等最初是想开发一个基于MATLAB的版本,但是由于MATLAB的一些限制和不足,加上他本身对Python非常熟悉,于是就有了matplotlib的诞生。所以,无论从名字上,还是从matplotlib提供的函数名称、参数及使用方法都与MATLAB非常相似。
matplotlibrc是配置文件,文件中有matplotlib默认参数设置。
import matplotlib
matplotlib.matplotlib_fname() #将会获得matplotlibrc路径
或者
print(plt.rcParams.keys())
KeysView(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’,
‘animation.html_args’: [],
‘animation.mencoder_args’: [],
‘animation.mencoder_path’: ‘mencoder’,
‘animation.writer’: ‘ffmpeg’,
‘axes.autolimit_mode’: ‘data’,
‘axes.axisbelow’: ‘line’,
‘axes.edgecolor’: ‘k’,
‘axes.facecolor’: ‘w’,
‘axes.formatter.limits’: [-7, 7],
‘axes.formatter.min_exponent’: 0,
‘axes.formatter.offset_threshold’: 4,
‘axes.formatter.use_locale’: False,
‘axes.formatter.use_mathtext’: False,
‘axes.formatter.useoffset’: True,
‘axes.grid’: False,
‘axes.grid.axis’: ‘both’,
‘axes.grid.which’: ‘major’,
‘axes.hold’: None,
‘axes.labelcolor’: ‘k’,
‘axes.labelpad’: 4.0,
‘axes.labelsize’: ‘medium’,
‘axes.labelweight’: ‘normal’,
‘axes.linewidth’: 0.8,
‘axes.prop_cycle’: cycler(‘color’, [’#1f77b4’, ‘#ff7f0e’, ‘#2ca02c’, ‘#d62728’, ‘#9467bd’, ‘#8c564b’, ‘#e377c2’, ‘#7f7f7f’, ‘#bcbd22’, ‘#17becf’]),
‘axes.spines.bottom’: True,