matplotlib——配置参数

matplotlib是一个基于Python的绘图库,其设计理念受到MATLAB的影响。matplotlibrc是配置文件,包含默认参数设置,如轴、网格、字体和颜色等。通过修改rcParams,可以方便地定制matplotlib的显示效果,实现各种视觉风格的图表。本文详细介绍了matplotlib的参数配置,并提供了重置为标准设置的方法。
摘要由CSDN通过智能技术生成

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,

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值