前言:
matplotlib使用matplotlibrc配置文件自定义各种属性,我们称之为rc设置或rc参数。你可以控制matplotlib中几乎所有属性的默认值:图形大小和dpi、线宽、颜色和样式、轴、轴和网格属性、文本和字体属性等等。
the creators of matplotlib were originally focused on building a GTK+ application for researchers and providing
a command interface for the interactive plotting of data, not unlike that provided by MATLAB.
创作Matplotlib的初衷就是为研究开发者建立一个GTK+的应用,提供一个命令的接口用来交互的绘制数据。
架构分为三层
- Scripting Layer
- Artist Layer
- Backend Layer
Scrpting Layer
背景:虽然后端层着重于提供公共的接口,并渲染呈现艺术层的图元和容器,但是脚本层是面向用户的接口,它简化了与其他层一起工作的任务,将后端和艺术层的很多功能包装起来,形成两类包装类型:
- 后端包装器
- Module
- Draw
- Factory
- Mainloop
- 艺术层包装类型
- Figure
- Axes
- Plot
- Hold
当导入pyplot库之后,它会为系统选择默认的后端,或者之前你配置的后端。
在选择完后端之后,它就要调用一系列的初始化函数:
- Creates a figure manager factory function, which when called will create a new figure manager appropriate for the selected backend:创建一个图片管理工厂函数
- Prepares the drawing function that should be used with the selected backend (taking into account whether the backend is a hardcopy or a user interface):
为选择的后端准备一个绘制函数 - Identifies the callable function that integrates with the backend mainloop function:
标识与后端主循环函数集成的可调用函数 - Provides the module for the selected backend:为选择的后端提供模块
The py