Skip to main content

rosen_style

Consistent, readable Matplotlib defaults for Rosen Research Group papers and presentations.

Install

pip install git+https://github.com/Quantum-Accelerators/rosen_style.git

Use

import matplotlib.pyplot as plt
import rosen_style

rosen_style.use("paper")  # or "presentation"
fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 0])
ax.set(xlabel="Time (s)", ylabel="Response (a.u.)")

Use a context manager to apply a style temporarily:

import matplotlib.pyplot as plt
import rosen_style

with rosen_style.context("paper"):
    fig, ax = plt.subplots()
    ax.scatter([1, 2, 3], [2.1, 3.8, 6.2])
    ax.set(xlabel="Concentration (mol/L)", ylabel="Response (a.u.)")
    fig.savefig("response.png")  # saved at the style default of 600 DPI

Paper figures default to a 3.25-inch single-column width, with height chosen using the golden ratio. Use columns=2 for a 7-inch double-column figure:

with rosen_style.context("paper", columns=2):
    fig, ax = plt.subplots()
    ax.plot([0, 1, 2], [0, 1, 0])
    fig.savefig("double-column.png")

Pass square=True for equal figure width and height, which is useful for parity plots and heatmaps. See the main Matplotlib settings for the complete defaults.

Outside the with block, Matplotlib's previous settings are restored.

The defaults use 600 DPI for display and saved output, a color-vision-friendly categorical cycle, the perceptually uniform plasma image colormap, readable labels, white saved backgrounds, no grid lines, and minor ticks in paper mode. Figure titles are intentionally left to captions or surrounding presentation content. Pair color with markers, line styles, or direct labels when it carries meaning.

Examples

Line plot:

Paper line plot

Scatter plot (with square=True):

Paper scatter plot

Heatmap with a perceptually uniform color scale:

Paper heatmap

CI regenerates and commits these images when their source or the styles change.

Design references

There are also many excellent Python examples on The Python Graph Gallery and Python Charts websites. For what not to do, check out the "Friends Don't Let Friends Make Bad Graphs" repository.

Download files

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

Source Distribution

rosen_style-0.0.1.tar.gz (7.9 kB view details)

Uploaded Source

File details

Details for the file rosen_style-0.0.1.tar.gz.

File metadata

  • Download URL: rosen_style-0.0.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rosen_style-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b88b7838d43c68ad5e2b1c992132f05fc88989dad36304756d6d74ff08553e1e
MD5 3fb47372e4e9b0c2b4b94f5d859a9f84
BLAKE2b-256 5fc151bb4ed0b8eff85d1d4c8e446d6d3ad8203988187863355445d14e7d5ed7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page