Usage Guide¶
dartwork-mpl bundles stylistic presets, curated colors/colormaps, and layout/font helpers so you get predictable results fast.
The Evolution of a Plot
Drag the slider to experience the dartwork-mpl pipeline step-by-step.
Choosing the right tools¶
Which preset?¶
Your context |
Preset |
Why |
|---|---|---|
Academic paper / journal |
|
Compact fonts (7.5 pt), all 4 spines, fits 3.5” column |
Business report / memo |
|
Clean look, no top/right spines, 8 pt fonts |
Infographic / editorial |
|
Tufte-style, no spines/ticks, data-ink focus |
PowerPoint / Keynote |
|
Large fonts (10.5 pt), readable when projected |
Conference poster |
|
Largest fonts (12 pt), thick lines, 1-2m reading distance |
Web docs / blog |
|
Screen-optimized 11 pt, clean for HTML/Jupyter |
Dark Jupyter / dark slides |
|
Inverted colors on |
Any of the above + Korean |
Add |
Swaps to Paperlogy/Pretendard fonts |
Which layout function?¶
Situation |
Function |
Notes |
|---|---|---|
Most figures |
|
Fast, consistent margins via L-BFGS-B optimizer |
Long labels or multi-line titles |
|
Detects and fixes text overflow automatically |
Multi-panel with GridSpec |
|
Respects your |
Need exact margin control |
|
Specify margins in inches |
Which color palette?¶
Style |
Prefix |
Best for |
|---|---|---|
Open Color |
|
General purpose, well-balanced (recommended default) |
Tailwind CSS |
|
Web-style designs, wider shade range (50–950) |
Material Design |
|
Google-style, vibrant |
Ant Design |
|
Enterprise UI aesthetics |
Chakra UI |
|
Modern web app colors |
Primer |
|
GitHub-style, subtle |
Typical workflow¶
dm.style.use("scientific") sets fonts, line weights, spines, and tick
styling in one call — 7 presets cover papers, reports, slides, posters,
web, and dark mode. No manual rcParams guessing.
Use named colors like "oc.blue5" or "tw.emerald500" anywhere matplotlib
accepts a color string. 900+ curated swatches from 6 design systems,
plus perceptual OKLCH interpolation.
dm.simple_layout(fig) optimizes margins via L-BFGS-B — uniform spacing
even with colorbars and long labels. dm.label_axes() adds panel labels
automatically.
dm.save_formats(fig, "output/fig", formats=("png", "svg")) writes
multiple formats at once. Add validate=True to auto-detect overflow,
overlap, and crowding before saving.
Launch a local web UI to tweak parameters with sliders, download plots, and generate reproducible Python scripts on the fly.
Tip
Where do assets live? Style files are in asset/mplstyle/, colors in
asset/color/, fonts in asset/font/, and figure constants in
dm.SW, dm.DW. See Design Philosophy
for the architecture behind these choices.