Skip to main content

matplotlib Cheat Sheet

figure

class matplotlib.figure.Figure(figsize=None, dpi=None, *,
                facecolor=None, edgecolor=None,
                linewidth=0.0, frameon=None,
                subplotpars=None,
                tight_layout=None, constrained_layout=None,
                layout=None, **kwargs)

pyplot

subplots
matplotlib.pyplot.subplots(
      nrows=1, ncols=1, *, sharex=False, sharey=False,
      squeeze=True, width_ratios=None, height_ratios=None,
      subplot_kw=none, gridspec_kw=None,
      **fig_kw)

subplots create a figure and a set of subplots

parameter type description
nrows,ncols int, default 1 num of rows and cols
sharex, sharey bool or {none,all,row,col} default False
squeeze bool, default True if True, extra dimensions are squeezed out
subplot_kw,gridspec_kw Dict with keywords
fig_kw additional keywords passed to pyplot.figure
scatter
matplotlib.pyplot.scatter(x, y,
                        c=None, marker=None, cmap=None,
                        norm=None, vmin=None, alpha=None,
                        linewidth=None, *, edgecolors=None,
                        plotnonfinite=False, data=None,
                        **kwargs)
parameter type description
s float or array-like marker size in points**2
c array-like or list of colors the marker colors
alpha float, default:None transparency between [0,1]