https://www.runoob.com/w3cnote/matplotlib-tutorial.html
https://www.jianshu.com/p/da385a35f68d
Matplotlib 是 Python 的绘图库。 它可与 NumPy 一起使用,提供了一种有效的 MatLab 开源替代方案。 它也可以和图形工具包一起使用,如 PyQt 和 wxPython。
如果这两种颜色不够用,还可以通过两种其他方式来定义颜色值:
1、使用HTML十六进制字符串 color=’#123456’ 使用合法的HTML颜色名字(’red’,’chartreuse’等)。
2、也可以传入一个归一化到[0,1]的RGB元祖。 color=(0.3,0.3,0.4)
背景色
通过向如matplotlib.pyplot.axes()或者matplotlib.pyplot.subplot()这样的方法提供一个axisbg参数,可以指定坐标这的背景色。
subplot(111,axisbg=(0.1843,0.3098,0.3098))
figure详解
plt.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=<class 'matplotlib.figure.Figure'>, clear=False, **kwargs)
Create a new figure.
Parameters
----------
num : integer or string, optional, default: None,相当于图片名
figsize : (float, float), optional, default: None width, height in inches. If not provided, defaults to :rc:`figure.figsize` = ``[6.4, 4.8]``.
dpi : integer, optional, default: None resolution of the figure. If not provided, defaults to :rc:`figure.dpi` = ``100``.
facecolor : color spec the background color. If not provided, defaults to :rc:`figure.facecolor` = ``'w'``.
edgecolor : color spec the border color. If not provided, defaults to :rc:`figure.edgecolor` = ``'w'``.
frameon : bool, optional, default: True If False, suppress drawing the figure frame.
FigureClass : subclass of `~matplotlib.figure.Figure` Optionally use a custom `.Figure` instance.
clear : bool, optional, default: False If True and the figure already exists, then it is cleared.
plt.plot详解
plot(*args, scalex=True, scaley=True, data=None, **kwargs) method of matplotlib.axes._subplots.AxesSubplot instance
Plot y versus x as lines and/or markers.
Parameters
----------
x, y : array-like or scalar *x* values are optional and default to `range(len(y))`.
Commonly, these parameters are 1D arrays. They can also be scalars(标量), or two-dimensional (in that case, the
columns represent separate data sets).
fmt : str, optional
A format string, e.g. 'ro' for red circles. See next *Notes*.
Format strings are just an abbreviation for quickly setting basic line properties. All of these and more can also be
controlled by keyword arguments.
data : indexable object, optional
An object with labelled data. If given, provide the label names to plot in *x* and *y*.
Other Parameters
----------------
scalex, scaley : bool, optional, default: True 不用管
**kwargs : `.Line2D` properties, optional
*kwargs* are used to specify properties like a line label (for auto legends), linewidth, antialiasing, marker face color.