Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 1.49 KB

File metadata and controls

56 lines (39 loc) · 1.49 KB

prettyplot

Publication-quality matplotlib plots, automatically.

prettyplot gives your matplotlib figures a clean, paper-ready look with a colorblind-safe palette — either by setting the style before you plot, or by handing any existing figure to beautify() to clean it up after the fact.

Install

pip install prettyplot

Or from a checkout:

pip install -e .

Usage

Two ways to use it, mix freely:

import matplotlib.pyplot as plt
import prettyplot as pp

# 1. Style before plotting -- everything comes out right:
pp.set_style("paper")
fig, ax = plt.subplots()
ax.plot(x, y)

# 2. Or hand any existing fig/ax to beautify() and it cleans up:
pp.beautify(ax)          # despine, thin ticks, muted labels, tight
pp.save(fig, "fig.pdf")  # vector, tight box, embedded fonts

beautify() restyles artists that already exist, so it also works on figures produced by third-party code (pandas .plot(), seaborn, someone else's function). It never redraws your data; it only restyles it.

Features

  • Stylesset_style("paper" | "wide" | "talk" | "poster") presets, plus a style() context manager and rc_params() for manual control.
  • Palettes — colorblind-safe CATEGORICAL, SEQUENTIAL, DIVERGING, and STATUS colors, plus a categorical() helper.
  • Savingsave() writes vector output (PDF/SVG/EPS) with a tight box and editable text by default.

See examples/ for runnable demos.

License

MIT