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 width, with height chosen using the golden ratio. Use wide=True for a 7-inch-wide figure:
with rosen_style.context("paper", wide=True):
fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 0])
fig.savefig("wide.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:
Scatter plot (with square=True):
Heatmap with a perceptually uniform color scale:
Multiple subpanels
The style works with Matplotlib's standard subplot layouts. Use nrows and
ncols to arrange panels; wide=True sets the total paper figure width to
7 inches. Font and line sizes stay
at paper defaults.
with rosen_style.context("paper", wide=True):
fig, axes = plt.subplots(2, 2, sharex=True, sharey=True)
for ax in axes.flat:
ax.plot([0, 1, 2], [0, 1, 0])
ax.set(xlabel="Time (s)", ylabel="Response (a.u.)")
ax.label_outer()
fig.savefig("subpanels.pdf")
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.
Metadata
Release files for rosen-style 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rosen_style-0.0.2.tar.gz | 8.1 kB | Without provenance | Details for rosen_style-0.0.2.tar.gz |
Release files / rosen_style-0.0.2.tar.gz
| Download URL | rosen_style-0.0.2.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb4768af93bbe17bd764b978d23eddce054a8f813033505508291f9f9cc7f14a
|
|
BLAKE2b-256 checksum How to use checksums |
d371008c8deb67436c0c21f6108ce2db49139a3d5b39ddd8a9ebc9929d9f77d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for rosen-style 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.