Skip to main content

A simple plotting library

Project description

EasyPlotLib

Matplotlib styles and helpers for publication-quality SCI-journal figures (Nature / Science / Cell / NEJM / Lancet / PNAS / AGU / AMS).

Built with the bundled nature style — see the full gallery.

Install

pip install EasyPlotLib

Quick start

import EasyPlotLib as epl
import matplotlib.pyplot as plt
import numpy as np

# Style + journal column width + color palette in one call.
epl.journal_style("nat1", palette="nature", nrows=1, ncols=2)

fig, axs = plt.subplots(1, 2)
x = np.linspace(0, 2 * np.pi, 200)
for n, ax in enumerate(axs):
    for k in range(3):
        ax.plot(x, np.sin(x + k), label=f"series {k}")
    ax.set_xlabel("x")
    ax.set_ylabel("amplitude")
    ax.annotate(**epl.subplot_labels(n, "a"))      # bold panel labels a, b …

# Editable vector (PDF) + 600-dpi raster.
epl.save_pub(fig, "figures/fig1", formats=("pdf", "png"))

API

Function Description
journal_style(key, palette=, base_style=, nrows=, ncols=, apply=) Apply style + size + palette in one call. Returns the figsize dict.
figsizes(key, ...) rcParams dict with a journal column figure size. Keys: nat1/2, aaas1/2, pnas1..3, agu1..4, ams1..4.
subplot_labels(n, style) Args for ax.annotate(**...). Styles: a, A, (a), a), a.
set_palette(name, ax=None) / get_palette(name, n=) Set the color cycle / return raw hex list.
PALETTES Qualitative palettes: nature, science, nejm, lancet, jama, muted, semantic, nmi, comparison, imaging, bright.
SEMANTIC Role-based colors (blue_main=hero, green_strong=gain, red_strong=drop, delta_up/down, neutrals, accents).
shades(color, n) n shades of one hue, light→base — related methods (e.g. a baseline trio, stacked-area family).
alpha_ramp(color, n) One hue at graduated opacity — the standard ablation encoding.
COLORMAPS Recommended continuous colormaps for heatmaps/images: sequential, sequential_warm, diverging, grayscale.
save_pub(fig, path, formats=, dpi=) Save to multiple formats with editable vector text.
cartopy_plot_tickmarks(ax, gl) Clean lon/lat tick labels for cartopy maps.

Color scheme guidance

Every recurring nature-style color pattern is abstracted into one small, shared API so a whole figure stays consistent (the examples/gallery.py panels all draw from it):

  • One restrained palette per figure. Use a unified family across panels rather than maximizing hue variety; reduce saturation before adding categories.
  • Assign color by meaning, not by index. SEMANTIC reserves blue_main for the proposed/hero method and green/red for gains/drops. Never remap the same method to a different hue in another panel.
  • Many-method comparisonget_palette("comparison"): soft pastel baselines with related methods sharing a hue family, and one saturated hero (put your method last).
  • Related methods / one familyshades(color, n): graduated lightness of a single hue (baseline trios, stacked-area bands).
  • Ablationsalpha_ramp(color, n): one hue, opacity carries the ordering.
  • Continuous data (heatmaps, density, images) → a perceptual colormap from COLORMAPS — sequential for magnitude, diverging for signed values.
  • Microscopyimaging accents (cyan/magenta) on a black background.

Examples

examples/README.md is an index of all worked examples (chart gallery, cartopy/China maps, WRF nested-domain maps) — match your task to a row and adapt that file rather than starting from scratch. Geoscience map helpers and the WRF study-area figure live there too.

Chart-type gallery

examples/gallery.py renders one publication-styled panel per common archetype. Every panel sources its colors from the abstracted API above, so a method keeps its hue across the whole figure (blue = hero, grey = baseline):

python examples/gallery.py   # writes PNGs to examples/gallery/

Method comparison · get_palette("comparison")

Ablation · alpha_ramp()

Trend + CI · SEMANTIC

Heatmap · COLORMAPS["sequential"]

Scatter / bubble · SEMANTIC

Radar / polar · SEMANTIC

Violin + box · shades()

Forest / interval · SEMANTIC

Stacked area · shades()

Style notes

The bundled nature style uses 7 pt sans (TeX Gyre Heros / Helvetica), an open frame (no top/right spines), and export settings that keep text editable in Illustrator/Inkscape (pdf.fonttype=42, svg.fonttype=none) at 600 dpi.

Claude Code skill

A personal sci-figure skill (~/.claude/skills/sci-figure/) walks Claude through the publication workflow and is auto-invoked on plotting tasks in any project where EasyPlotLib is installed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easyplotlib-0.2.7.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easyplotlib-0.2.7-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file easyplotlib-0.2.7.tar.gz.

File metadata

  • Download URL: easyplotlib-0.2.7.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for easyplotlib-0.2.7.tar.gz
Algorithm Hash digest
SHA256 3ed1786f99b9e9baa91be9f06f5302a9f3e6106d0377cbc93464afcbafd90c3d
MD5 0d1ada5a3d5e2ff023cdedefe5bd5a82
BLAKE2b-256 f74ac88df113bb0a609d0a3c9cfc912a1b069f114b97ad7fd8e6c2787eea6911

See more details on using hashes here.

File details

Details for the file easyplotlib-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: easyplotlib-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for easyplotlib-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fb65a34c3678aa11bdc6cf7c55a69d989693d4c3dc34054d4d5de496dc71907c
MD5 91ed13bb402d0d094517b3cfde9ad431
BLAKE2b-256 4820cf69ec6b1155f57273085e274736a14730d31f6bd935d531bfe4727a38a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page