- link
- setup
mamba install matplotlib
pip install matplotlib
- figure part: figure, axes, title, legend, line, marker, grid, spline, axis label, major/minor tick, major/minor tick label, artist
- 偏见
- 禁止使用
matplotlib.pylab:初衷模仿MATLAB,包含pyplot和numpy模块中大部分的接口
- 尽量不使用
plt state machine environment api,转为使用 objec orientied interface
- 关闭图片窗格必须显示调用
plt.close(plt.gcf()), see link-last-paragraph
- 禁止在
matplotlib中使用numpy.recarray, pandas.DataFrame,虽然支持,see link
- configuration
matplotlib.rcParams
matplotlibrc
matplotlib.get_configdir()
*.mplstyle: style configuration
- math: mathtext, LaTeX matplotlib/doc
- backend
- interactive backend (user interface backend): pygtk, wxpython, tkinter, qt4, macosx
- non-interactive backend (hardcopy backend): PNG, SVG, PDF, PS
matplotlib.rcParams['backend'], os.environ['MPLBACKEND'], matplotlib.use()
- renderer (vector or raster) and canvas
- case-insensitive:
gtk3agg or GTK3Agg
- Anti-Grain Geometry C++ library (Agg)
- artist: line, text (LaTeX expression), histogram, annotation
import matplotlib
import matplotlib.pyplot as plt
plt.ion()
plt.ioff()
plt.draw()
matplotlib.interactive()
matplotlib.is_interactive()
plt.close()
plt.clf()
plt.cla()
ax.remove()
- link
- install
mamba install -c conda-forge scienceplots
pip install SciencePlots