Skip to main content

Stoner Plots

Not platform specific MIT Licensed Build Docs pytest Codacy Badge Conda GitHub version GitHub Release Date PyPI version Conda Version DOI

Stoner Plots is a fork of Science Plots with additional features to make plotting of scientific plots easier.

Presentation Style Image

Usage

Before using the new styles you need to import stonerplots - but you will most likely also want to make use of one of the context managers - the SavedFigure class.

from stonerplots import SavedFigure

with SavedFigure("my_figure.pdf", style=["stoner","aps"]):
    plt.figure()
    plt.plot(x,y,label="Dataset")
    ...

There are three main parts to this package:

  1. A set of matplotlib style sheets for making plots with styles suitable for a variety of Physics related journals and formats such as presentations and posters as well as reports and theses.

  2. A set of Python Context managers designed to help with the process of preparing production quality figures in matplotlib.

  3. Some definitions of colours based on the Transport for London colour palette and inserted as named colours into the matplotlib colour tables.

The package is fully documented (see link below) and comes with a set of examples that also serve as unit tests.

Documentation

Documentation can be found on the github pages for this repository.

Available Styles

Core Styles

  • stoner - this is the base style sheet
  • poster - makes everything bigger for printing on a poster
  • notebook - makes things a little bigger for a Jupyter notebook - from the original scienceplots package
  • presentation - a style suitable for the main graph on a powerpoint slide
  • thesis - a style that tries to look like the CM Physics group LaTeX thesis template

Journal Styles

  • nature - for Nature group journals - from the original scienceplots package
  • aaas-science - Science single column style.
  • ieee - for IEEE Transactions journals - from the original scienceplots package
  • aps - for American Physical Society Journals (like Phys Rev Lett etc.)
  • aip - for AIP journals such as Applied Physics Letters - labels in Serif Fonts
  • iop - for Institute of Physics Journals.

Modifiers

  • aps1.5 - Switch to 1.5 column wide format
  • aps2.0 - Switch to 2 column wide format
  • aip2 - Switch to 2 column wide format for AIP journals
  • stoner-dark - Switch to a dark background a lighter plotting colours.
  • hi-res - Switches to 600dpi plotting (but using eps, pdf or svg is generally a better option)
  • med-res - like hi-res, but switches to 300dpi plotting.
  • presentation_sm - a style for making 1/2 width graphs.
  • presentation_dark - tweak the weight of elements for dark presentations.
  • science-2col, science-3col - Science 2 and 3 column width figures
  • thesis-sm - reduces the figure width to make the axes closer to 4/3 aspect ratio.

Context Managers

The package is designed to work by using python context managers to aid plotting. These include:

  • SavedFigure - apply style sheets and then save any resulting figures to disc in one or more formats
  • CentredAxes - makes a plot where the axes cross at the origin and there is no outside frame.
  • StackVertical - make a multi-panel plot where the panels are arranged in a vertical stack and pushed together so that the top-x-axis on one frame is the bottom of the next.
  • MultiPanel - a general-purpose multi-panel plotting helper.
  • OffsetPlots - separate related datasets with constant y offsets or log-axis factors, pairing lines with scatter points and moving complete error-bar plots together.
  • InsetPlot - create an inset set of axes.
  • DoubleYAxis - setup the righthand y axis for a second scale and optional colour the y-axes differently and merge the legend into a single legend.

Colour Cycles

The default colour cycle is based on the London Underground map colour scheme (why not?) and goes

  • Northern
  • Central
  • Picadily
  • District
  • Metropolitan
  • Bakerloo
  • Jubilee
  • Overground
  • Victoria
  • Elizabeth
  • Circle

Reference

The package adds these as named colours in matplotlib, along with 90,50,70 and 10% shade variants of some of them. See the documentation page on colours for a full list.

This package draws heavily on scienceplots, so it seems only fair to cite the original work....

@software{john_garrett_2023_10206719,
  author       = {John Garrett and
                  Echedey Luis and
                  H.-H. Peng and
                  Tim Cera and
                  gobinathj and
                  Josh Borrow and
                  Mehmet Keçeci and
                  Splines and
                  Suraj Iyer and
                  Yuming Liu and
                  cjw and
                  Mikhail Gasanov},
  title        = {garrettj403/SciencePlots: 2.1.1},
  month        = nov,
  year         = 2023,
  publisher    = {Zenodo},
  version      = {2.1.1},
  doi          = {10.5281/zenodo.10206719},
  url          = {https://doi.org/10.5281/zenodo.10206719},
}

The doi and BibTex reference for stonerplots is: https://doi.org/10.5281/zenodo.14026874

@software{gavin_burnell_2024_14026874,
  author       = {Gavin Burnell},
  title        = {stonerlab/stonerplots},
  month        = February,
  year         = 2026,
  publisher    = {Zenodo},
  version      = {v1.9.2},
  doi          = {10.5281/zenodo.14026874},
  url          = {https://doi.org/10.5281/zenodo.14026874},

}

Metadata

Release files for StonerPlots 1.9.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for StonerPlots 1.9.7
File Size Uploaded Provenance Actions
stonerplots-1.9.7.tar.gz 3.5 MB Without provenance Details for stonerplots-1.9.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for StonerPlots 1.9.7
File Interpreter ABI Platform Actions
stonerplots-1.9.7-py3-none-any.whl Python 3 none any Details for stonerplots-1.9.7-py3-none-any.whl

Total release size: 3.5 MB

Release files / stonerplots-1.9.7.tar.gz

Download URL stonerplots-1.9.7.tar.gz
Size 3.5 MB
Tags Source
SHA-256 checksum
How to use checksums
772ba55001f0237aecc360c6d4b7ce723e29a72f12e59a164bb76ac7da573845
BLAKE2b-256 checksum
How to use checksums
4eb49912de27f74f97510f7665d063ab174a81d4335d8867dba4fbf44014e84d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / stonerplots-1.9.7-py3-none-any.whl

Download URL stonerplots-1.9.7-py3-none-any.whl
Size 59.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
433f31354a440b89d72316b880b3edf1e66365eb180b908f360b4cbac49fa940
BLAKE2b-256 checksum
How to use checksums
46335fd79e06c2c12f726c52053504543d7c6097d77f87a3388477edbd3b1b9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for StonerPlots 1.9.7

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.

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