Skip to main content

Publication-quality Matplotlib styling for peer-reviewed journals.

Project description

PeerStyle

Publication-quality Matplotlib styling for peer-reviewed journals.

Installation

pip install peerstyle

Usage

import matplotlib.pyplot as plt
import peerstyle

# List available styles
print(peerstyle.list_styles())
# ['custom_style', 'ieee', 'nature', 'poster']

# Apply a specific style
peerstyle.use_style('nature')

Visual Gallery

Default (custom_style) IEEE Journal (ieee)
Nature Journal (nature) Presentation Poster (poster)

Available Styles

  • custom_style: The default serif scientific style (high DPI, LaTeX enabled).
  • ieee: Following IEEE journal guidelines (Times New Roman, specific sizing).
  • nature: Following Nature journal guidelines (Sans-serif, compact).
  • poster: High-visibility style with large fonts and thick lines for presentations.

Features

  • Journal Presets: Ready-to-use styles for IEEE, Nature, and more.
  • Modern Packaging: Fully installable via pip.
  • High Quality: Pre-configured for publication-quality PDF and PNG exports (300 DPI).
  • Flexible: Combine multiple styles or use them alongside standard Matplotlib styles.
  • Curved Text: Label lines directly along their paths — no legend needed.
  • CI/CD: Automated testing via GitHub Actions.

Curved Text — Direct Line Labeling

Label curves along their own paths instead of in a legend, so the eye never leaves the data to decode a colour key.

import numpy as np
import matplotlib.pyplot as plt
import peerstyle

peerstyle.use_style('nature')

x = np.linspace(0, 2 * np.pi, 400)

fig, ax = plt.subplots()
ax.plot(x, np.sin(x), color='C0')
ax.plot(x, np.cos(x), color='C1')

peerstyle.curved_text(ax, x, np.sin(x), 'sin(x)', pos=0.25, offset=6, color='C0')
peerstyle.curved_text(ax, x, np.cos(x), 'cos(x)', pos=0.30, offset=6, color='C1')

plt.show()

Placement is controlled by three parameters:

Parameter Default Description
pos 0.5 Where the label is anchored along the curve, as a fraction of arc length (0 = start, 1 = end).
anchor "center" Which part of the label lands at pos: "start", "center", or "end".
offset 0.0 Perpendicular shift off the curve in typographic points. Positive is above a left-to-right curve.

Extra keyword arguments (color, fontsize, alpha, fontfamily, …) are passed through to each character's matplotlib.text.Text.

The object-oriented form is also available:

from peerstyle import CurvedText

CurvedText(x, y, 'along the curve', ax, pos=0.2, anchor='start', offset=4.0)

The label recomputes its position on every draw, so it keeps following the curve through figure resizing and interactive panning or zooming.

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

peerstyle-0.1.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

peerstyle-0.1.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file peerstyle-0.1.3.tar.gz.

File metadata

  • Download URL: peerstyle-0.1.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.15

File hashes

Hashes for peerstyle-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b2d0dcb7b60075e22dc078565753160677162f0f95ec645a11f6e2c6ccbbe0ec
MD5 ff61abb78041ab6bad1385892614135c
BLAKE2b-256 b79092aab3e52f468c8f64470cc01aef0a91252a187c17eecb7f030c45f8a6bc

See more details on using hashes here.

File details

Details for the file peerstyle-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: peerstyle-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.15

File hashes

Hashes for peerstyle-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b1c45d6fc274665dd2e31c4f9df26a743e7977f4342e3835f0e16c4fc5447b81
MD5 b86330cab4484ea34e7d4755570db07d
BLAKE2b-256 6118bd1f75ddb0e3a941ee2ce94fd267ec98d43d624fb2694a1860ede4e76b67

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