Skip to main content

Lightweight plotting utilities for consistent well-readable matplotlib figures

Project description

myplots

Minimal plotting utilities for consistently formatted scientific matplotlib figures.

Usage

import myplots as p

p.use_style()
fig, ax = p.new()

Installation

Clone the repository and install in editable mode:

pip install -e .

Quick start

import numpy as np
import myplots as p

# Apply global plotting style
p.use_style(doc_fontsize=10, fig_width="single")

# Generate some data
x = np.linspace(0, 10, 100)
y = np.sin(x)

# Create figure
fig, ax = p.new()

# Plot
p.line(ax, x, y, label="signal")
p.label(ax, rf"{p.bm('x')} axis", rf"{p.bm('y')} axis")
p.legend(ax)

# Save
p.save(fig, "figure.png")

Plotting

p.line(ax, x, y)
p.scatter(ax, x, y)
p.errorbar(ax, x, y, yerr)

Subplots

fig, axs = p.new(nrows=2, ncols=2)

Labels and legends

p.label(ax, "x", "y", "Title")
p.legend(ax)

Subplot annotation

p.annotate_subplots(axs)

Domain specific helpers

p.plot_energy(ax, t, E)
p.plot_temperature(ax, t, T)
p.plot_histogram(ax, data)
p.plot_with_error(ax, x, y, yerr)

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

myplots-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

myplots-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file myplots-0.1.0.tar.gz.

File metadata

  • Download URL: myplots-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for myplots-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3ab72d3b3ee2d2a413e9a628f5d60d6014ed65ef4187e4f0e92f6d78c0cc54aa
MD5 9a2917ebf762c6533f870c847e7b3b46
BLAKE2b-256 60c091da6d128e1533a76e948eee503ea2fda576f03f19cc5c77a1ab87b6d346

See more details on using hashes here.

File details

Details for the file myplots-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: myplots-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for myplots-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e2a8f079f059b56568abd497ec4552684ae88ef02d7f19280c248bb99e2ffc2
MD5 0774b5213bd1149c32c8081cfba23315
BLAKE2b-256 eabc0566d58ab3da0f7ed52d6e086cec21f615e2c6f37b621abbef8a5faf190f

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