Skip to main content

This is a fork of scienceplots and provides a range of matplotlib styles for plotting physics...

Project description

GitHub version pytest PyPI version Build Docs Conda Conda Version Not platform specific MIT Licensed DOI

Stoner Plots

Stoner Plots is a fork of Science Plots

Presentation Style Image

Usage

Before using the new styles you need to import stonerplots - but it's ok to just import e.g. the SavedFigure context manager:

from stonerplots import SavedFigure

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

The SavedFigure context manager will handle the call to the matplotlib style context manager and will also save any figures opened within the context manager. If the filename for the figure has an embedded place holder for {ix}, then multiple figures can be saved without clobbering the filename.

There is also an InsetPlot context manager that can help you get insets placed correctly so that axes labels don't escape over the edge of the surrounding figure.

with SavedFigure("my_figure.pdf", style=["stoner","aps"]):
    plt.figure()
    plt.plot(x,y,label="Dataset")
    ...
    with InsetPlot(loc="lower right", width=0.25, height=0.25, padding=0.05) as inset:
        inset.plot(x, model(x, 200), linestyle="--")

See below for the full list of styles and context managers.

Documentation

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

Available 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 columne 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)
  • presentation_sm - a style for making 1/2 width graphs.
  • presentation_dark - tweak the weight of elements for dark presnetations.
  • 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.

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

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.

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
  • 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 miulti-panel plotting helper.
  • InsetPlot - create an inset set of axes.

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

@article{StonerPlots,
  author       = {John D. Garrett},
  title        = {{garrettj403/SciencePlots}},
  month        = sep,
  year         = 2021,
  publisher    = {Zenodo},
  version      = {1.0.9},
  doi          = {10.5281/zenodo.4106649},
  url          = {http://doi.org/10.5281/zenodo.4106649}
}

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

stonerplots-1.5.1.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

StonerPlots-1.5.1-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file stonerplots-1.5.1.tar.gz.

File metadata

  • Download URL: stonerplots-1.5.1.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.15

File hashes

Hashes for stonerplots-1.5.1.tar.gz
Algorithm Hash digest
SHA256 99522b61f80013b4bdaa2de8aa1e1a821aaa3a5b713d55da155858473b54a1f4
MD5 a6dbcb5b4e5efdd65c4326c2dad9abf5
BLAKE2b-256 a2ea165cf7487f536ecd50d1bc6542f5ecafb35e079853e821a126398d7b4226

See more details on using hashes here.

File details

Details for the file StonerPlots-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: StonerPlots-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.15

File hashes

Hashes for StonerPlots-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60d8ac869483a03e89e6171c441901cc5cdcefe5f3afbe83a99fb99f81e47ecc
MD5 e69adb59728f8508228f3e6278048ba8
BLAKE2b-256 68b372fce8feacf8eb1fb8be9310ef741659fb206683ddb1dd12d37dde97926a

See more details on using hashes here.

Supported by

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