Skip to main content

Publication-quality Matplotlib styling and helper utilities for scientific plots

Project description

physics-plot

PyPI - Version PyPI - Downloads

physics-plot is essentially a zero dependency python package shipping a Matplotlib style sheet — pp_base.mplstyle to create publication-quality plots with minimal effort. In addition, a few optional helper classes are provided.

Features

  • Matplotlib style sheetphysics_plot.pp_base enforces serif fonts, LaTeX math, minimalist grids, and high-resolution exports out of the box.
  • Legend utilitiesphysics_plot.Handles makes it easy to build custom legend entries for artists (e.g., violin plots) that don’t expose a label argument.

Installation

pip install physics-plot

Quick Start

physics-plot can be installed via pip:

pip install physics-plot

There are basically two ways to use the physics-plot stylesheet. You can set it globally at the start of your script/notebook:

import matplotlib.pyplot as plt

plt.style.use("physics_plot.pp_base")

# ======================= #
# Your plotting code here #
# ======================= #

Or you can apply it to individual figures using a context manager:

import matplotlib.pyplot as plt

with plt.style.context("physics_plot.pp_base"):
    # ======================= #
    # Your plotting code here #
    # ======================= #

Examples

  • Bode plot (examples/bode-plot.py) generates a two-panel magnitude/phase plot for a first-order low-pass filter.

    Bode plot

  • Violin plot (examples/violin-plot.ipynb) demonstrates how to pair Handles with Axes.violinplot so the legend of the violin plot can be created, which is absent in Matplotlib.

    Violin plot

Feel free to start from either example when styling your own figures.

Development

  • Coming soon

License

This project is licensed under the MIT license.

Third-Party Licenses

This project includes or adapts files from:

  • SciencePlots (MIT License) Copyright (c) 2018 John Garrett
  • Matplotlib (BSD-compatible license) Copyright (c) 2012– Matplotlib Development Team
  • Seaborn (BSD 3-Clause License) Copyright (c) 2012–2023, Michael L. Waskom

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

physics_plot-0.2.3.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

physics_plot-0.2.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file physics_plot-0.2.3.tar.gz.

File metadata

  • Download URL: physics_plot-0.2.3.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.4

File hashes

Hashes for physics_plot-0.2.3.tar.gz
Algorithm Hash digest
SHA256 0f84e2d7492c1e74135acec10dfc74a0ddf77b36e5409f32fae7344aaf8db5fc
MD5 0b64ad15f2681dfd1bedbdca8df05868
BLAKE2b-256 2f43cb46b6061c67d6338ae11e990122d8f3da68434637d73bfdf5b98f230c35

See more details on using hashes here.

File details

Details for the file physics_plot-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for physics_plot-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 272bb757f17e346301ccbaa1ad69b47893d4fa5bdae637957433309dc331832b
MD5 598ebde9846cc03bb38b629b512c33b0
BLAKE2b-256 55a1e5d420e557ac8c922d2ab45c69ec30ad711b35be7a3b961e8505509b240a

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