dartwork-mpl is a sophisticated utility collection designed to elevate matplotlib visuals to publication-level elegance with added convenience features. It is being developed to resolve personal inconveniences in visualization using matplotlib and to provide more intuitive customization especially to beginners.
dartwork-mpl enriches plotting experience with:
- Enhanced Aesthetics: Apply our curated themes to make your charts visually appealing.
- Easy Customization: Effortlessly adjust plot styles to fit your publication's needs.
- Advanced Color System: Use custom colors with simple prefixes (
dm.,tw.) and extended Tailwind CSS palette. - Streamlined Workflow: Simplify your plotting code with our intuitive interface, saving time and reducing complexity.
- Publication-Ready Layout: Automatic layout optimization with
simple_layout()for professional results.
uv is a fast Python package installer and resolver. To install dartwork-mpl with uv:
# Add to your project
uv add git+https://github.com/dartwork-repo/dartwork-mpl
# Or install directly
uv pip install git+https://github.com/dartwork-repo/dartwork-mplpip install git+https://github.com/dartwork-repo/dartwork-mplAfter installation, import and apply a style preset:
import matplotlib.pyplot as plt
import dartwork_mpl as dm
# Apply scientific publication style
dm.style.use('scientific')
# For Korean text support
dm.style.use('scientific-kr')- Preset Styles: Ready-to-use presets for scientific papers, presentations, and reports
- Flexible Customization: Combine individual styles for fine-grained control
- Korean Language Support: Built-in Korean font support with
-krpresets
- dartwork-mpl Colors: Custom color palette with
oc.red5,oc.blue2, etc. - Tailwind CSS Integration: Full Tailwind palette with
tw.blue500,tw.gray200, etc. - Color Utilities: Mix colors and apply pseudo-transparency
- Smart Layout Optimization:
simple_layout()replacestight_layout()with better control - Unit Conversion:
cm2in()for precise figure sizing - Multi-format Export: Save figures in SVG, PNG, PDF, and EPS simultaneously
- Font Utilities: Relative font size (
fs()) and weight (fw()) adjustments
- Colormap Explorer: Preview and classify colormaps by type
- Color Palette Viewer: Display all available colors with names
- Font Gallery: Preview available fonts
import numpy as np
import matplotlib.pyplot as plt
import dartwork_mpl as dm
# Set style
dm.style.use('scientific')
# Create figure with precise sizing (single-column paper figure)
fig = plt.figure(figsize=(dm.cm2in(9), dm.cm2in(7)), dpi=200)
# Set up layout
gs = fig.add_gridspec(nrows=1, ncols=1,
left=0.17, right=0.95,
top=0.95, bottom=0.17)
ax = fig.add_subplot(gs[0, 0])
# Plot with custom colors
x = np.linspace(0, 10, 100)
ax.plot(x, np.sin(x), c='oc.red5', lw=0.7, label='Sin')
ax.plot(x, np.cos(x), c='tw.blue500', lw=0.7, label='Cos')
# Customize
ax.set_xlabel('X value')
ax.set_ylabel('Y value')
ax.legend(fontsize=dm.fs(-1))
# Optimize layout and save
dm.simple_layout(fig)
dm.save_and_show(fig) # Display in Jupyter
# Export in multiple formats
dm.save_formats(fig, 'output/figure',
formats=('svg', 'png', 'pdf', 'eps'),
dpi=600)📚 Full Documentation - Complete Sphinx documentation with:
- Usage Guide - Comprehensive guide to all features
- Example Gallery - Interactive examples with code and plots
- Color System - Full-width Colors and Colormaps reference
- API Reference - Detailed API documentation
Explore our comprehensive example gallery featuring:
- Basic Usage - Getting started with dartwork-mpl
- Color System - Custom colors and Tailwind CSS integration
- Layout Optimization - Advanced layout control with
simple_layout() - Scientific Figures - Multi-panel publication-ready plots
- Statistical Plots - Probability density, violin, and box plots
- Advanced Visualizations - Heatmaps, contours, streamplots, and 3D plots
Each example includes complete source code and rendered output.
| Preset | Description |
|---|---|
scientific |
Small fonts for academic papers |
presentation |
Large fonts for presentations |
investment |
Style for investment reports |
scientific-kr |
Scientific style with Korean support |
presentation-kr |
Presentation style with Korean support |
investment-kr |
Investment style with Korean support |
Encountered a bug or have a feature request? Please open an issue through our GitHub issue tracker. We appreciate your feedback and contributions.