Skip to content

Latest commit

 

History

History

README.md

matplotlib

  1. link
  2. setup
    • mamba install matplotlib
    • pip install matplotlib
  3. figure part: figure, axes, title, legend, line, marker, grid, spline, axis label, major/minor tick, major/minor tick label, artist
  4. 偏见
    • 禁止使用matplotlib.pylab:初衷模仿MATLAB,包含pyplotnumpy模块中大部分的接口
    • 尽量不使用plt state machine environment api,转为使用 objec orientied interface
    • 关闭图片窗格必须显示调用plt.close(plt.gcf()), see link-last-paragraph
    • 禁止matplotlib中使用numpy.recarray, pandas.DataFrame,虽然支持,see link
  5. configuration
    • matplotlib.rcParams
    • matplotlibrc
    • matplotlib.get_configdir()
    • *.mplstyle: style configuration
    • math: mathtext, LaTeX matplotlib/doc
  6. 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)
  7. 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()

Scienceplots

  1. link
  2. install
    • mamba install -c conda-forge scienceplots
    • pip install SciencePlots