libraryactiveMIT

dartwork-mpl

Publication-quality matplotlib — a thin utility layer, not a wrapper.

PythonmatplotlibOKLCHMCP

dartwork-mpl keeps matplotlib’s Figure and Axes fully native and adds the parts matplotlib makes tedious: a physical-width geometry API, curated style presets, an OKLCH-aware color system, deterministic content-aware layout, visual validation, and an MCP server for AI coding assistants. You keep writing matplotlib — just without the friction.

Made with dartwork-mpl in the four steps below, at a 17 cm two-column width. A second-order system as the damping ratio ζ goes from 0.1 to 1.0: (a) step response, (b) frequency response. Both panels share one OKLCH color ramp (dm.cspace), so the same ζ has the same color; ζ = 0.7 is drawn bold.
Made with dartwork-mpl in the four steps below, at a 17 cm two-column width. A second-order system as the damping ratio ζ goes from 0.1 to 1.0: (a) step response, (b) frequency response. Both panels share one OKLCH color ramp (dm.cspace), so the same ζ has the same color; ζ = 0.7 is drawn bold.

Installation

pip install dartwork-mpl        # or: uv add dartwork-mpl

Requires Python 3.10+. Extras: [notebook] for inline display in Jupyter, [mcp] for the AI-assistant server, [ui] for the interactive parameter viewer.

The whole workflow

import matplotlib.pyplot as plt
import dartwork_mpl as dm

dm.style.use("scientific")                                       # 1. curated preset
fig, ax = plt.subplots(figsize=dm.figsize("13cm", "standard"))   # 2. physical width × aspect
ax.plot(x, y, color="oc.blue5", lw=dm.lw(0))
dm.simple_layout(fig)                                            # 3. content-aware margins
dm.save_formats(fig, "figure", formats=("svg", "png", "pdf"))    # 4. multi-format save

Preset → figsize(width, aspect) → simple_layout → save_formats. No tight_layout(), no hand-tuned figsize=(w, h) arithmetic, no dpi= guesswork.

Highlights

  • Geometry, decoupled from inches — dm.figsize("13cm", "standard") takes a physical width and an aspect token; the height follows.
  • Deterministic layout — simple_layout(fig) measures every visible artist and places the grid arithmetically, reproducible across machines.
  • OKLCH-aware color — named palettes plus a Color class spanning OKLab / OKLCH / RGB with perceptual interpolation.
  • Curated styling — seven presets (scientific, report, presentation, …), each with a Korean -kr variant.
  • Validation & export — validate_figure(fig) flags overflow, overlap, and tick crowding; save_formats writes SVG / PNG / PDF / EPS at once.
  • AI-native — a bundled MCP server gives Claude Code, Cursor, and Windsurf lint and auto-fix, figure validation, and color lookup.
Dartwork

AI Software Development, Numerical Analysis, Engineering R&D

© 2026 Dartwork Co., Ltd. All rights reserved. Seoul