Matplotlib

Tricks

  • fig, axes = plt.subplots(rows, cols, ...) is the preferred way to create axis objects — the returned result is a 2-D array.
  • Setting label="__nolegend__" disables legend on a plot.
  • Calling ax.set_xxx() methods without arguments returns the current val.
  • A shape is called a patch
  • DPI of images defaults to 100 in IPython and 72 in Jupyter — pretty low.
  • plt.rc("figure", figsize=(10, 10)) to set defaults to methods, .matplotlibrc file can be used to configure the behavior of Matplotlib.