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.
pip install prettyplotOr from a checkout:
pip install -e .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 fontsbeautify() 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.
- Styles —
set_style("paper" | "wide" | "talk" | "poster")presets, plus astyle()context manager andrc_params()for manual control. - Palettes — colorblind-safe
CATEGORICAL,SEQUENTIAL,DIVERGING, andSTATUScolors, plus acategorical()helper. - Saving —
save()writes vector output (PDF/SVG/EPS) with a tight box and editable text by default.
See examples/ for runnable demos.