官方文档
可实现基础配置,下例是后端配置,主要是渲染方案相关
matplotlib.use(backend, warn=False, force=True)
# Select the backend used for rendering and GUI integration.
backend : str
The backend to switch to. This can either be one of the standard backend names, which are case-insensitive:
- interactive backends: GTK3Agg, GTK3Cairo, MacOSX, nbAgg, Qt4Agg, Qt4Cairo, Qt5Agg, Qt5Cairo, TkAgg, TkCairo, WebAgg, WX, WXAgg, WXCairo
- non-interactive backends: agg, cairo, pdf, pgf, ps, svg, template
or a string of the form: module://my.module.name.
实现对matplotlib的风格、环境配置。 Customizing Matplotlib with style sheets and rcParams
注:管理着整个画图板
class matplotlib.axes.Axes(fig, rect, facecolor=None, frameon=True, sharex=None, sharey=None, label='', xscale=None, yscale=None, **kwargs)
注:
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 5, 0.1);
y = np.sin(x)
plt.plot(x, y)
IIII matplotlib.pyplot.plot
plot([x], y, [fmt], *, data=None, **kwargs)
plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
fmt = '[marker][line][color]' 风格控制,参考链接
注:
内部调用,实际就是gca(),即get current axes的意思
def plot(*args, scalex=True, scaley=True, data=None, **kwargs):
return gca().plot(
*args, scalex=scalex, scaley=scaley, **({"data": data} if data
is not None else {}), **kwargs)
>>>> matplotlib.pyplot.subplot
subplot(nrows, ncols, index, **kwargs)
subplot(pos, **kwargs)
subplot(ax)
IIII matplotlib.pyplot.subplots
matplotlib.pyplot.subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, gridspec_kw=None, **fig_kw)[source]
待更新
其他参考:
【matplotlib】 图解pyplot figure、subplot、axes、axis的区别