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 (default) |
|
Content-aware margin pass — call after data is plotted |
Multi-panel with GridSpec |
|
Pass the parent |
Need exact margin control |
|
Or per-side |
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 "dc.ocean2" or "tw.emerald500" anywhere matplotlib
accepts a color string. 900+ curated swatches from 6 design systems,
plus perceptual OKLCH interpolation.
dm.simple_layout(fig) walks every visible artist on every axes,
finds the union extent, and snaps the GridSpec edges so the content
sits at the requested margin from the figure edge. Pass gs=gs for
multi-panel layouts. 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/, and fonts in asset/font/. Physical-width helpers live
in dm.units (dm.cm, dm.inch, dm.mm, plus the academic-column
sugar dm.col1 / dm.col2). See Design Philosophy
for the architecture behind these choices.