Details

Language / Topic
pythonPython
Category
Libraries

Rules

balanced

Matplotlib

- Use the object-oriented API (`fig, ax = plt.subplots()`) over pyplot state machine for anything beyond quick plots. Always label axes and set titles. Use `fig.savefig()` with `dpi=150, bbox_inches='tight'` for publication-quality output.

Matplotlib

- Use the object-oriented API (`fig, ax = plt.subplots()`) over pyplot state machine for anything beyond quick plots. Always label axes and set titles. Use `fig.savefig()` with `dpi=150, bbox_inches='tight'` for publication-quality output.
- Use `plt.subplots(nrows, ncols)` for multi-panel figures with shared axes. Set a consistent style with `plt.style.use('seaborn-v0_8')` or custom `rcParams`. Use `ax.set_xlim/ylim` for explicit axis ranges. Prefer `ax.bar/scatter/plot` methods over pyplot functions for composability. Use colormaps from `plt.cm` for continuous data.