Skip to main content

Maxplotlib

A clean, expressive wrapper around Matplotlib, Plotly, plotext, and tikzfigure for producing publication-quality figures with minimal boilerplate. Swap backends without rewriting your data — render the same canvas as a crisp PNG, an interactive Plotly chart, a terminal-native plotext figure, or camera-ready TikZ code for LaTeX.

Install

pip install maxplotlibx

Showcase

Quickstart

import numpy as np
from maxplotlib import Canvas

x = np.linspace(0, 2 * np.pi, 200)
y = np.sin(x)

canvas, ax = Canvas.subplots()
ax.plot(x, y)

Plot the figure with the default (matplotlib) backend:

canvas.show()

Render the same line graph directly in the terminal with the plotext backend:

terminal_fig = canvas.plot(backend="plotext")
print(terminal_fig.build(keep_colors=False))

Or plot with the TikZ backend:

canvas.show(backend="tikzfigure")

Terminal backend

The plotext backend is designed for terminal-first workflows. It currently supports line plots, scatter plots, bars, filled regions, error bars, reference lines, text/annotations, labels/titles, log axes, layers, matrix-style imshow() rendering, common patches, and multi-subplot canvases.

x = np.linspace(1, 10, 40)

canvas, ax = Canvas.subplots()
ax.plot(x, np.sqrt(x), color="cyan", label="sqrt(x)")
ax.errorbar(x[::8], np.sqrt(x[::8]), yerr=0.15, color="yellow", label="samples")
ax.set_title("Terminal plot")
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_xscale("log")
ax.set_legend(True)

canvas.show(backend="plotext")

Examples

Runnable example scripts live in examples/:

python examples/plotly_backend_basic.py
python examples/plotly_backend_parity.py

Layers

x = np.linspace(0, 2 * np.pi, 200)

canvas, ax = Canvas.subplots(width="10cm", ratio=0.55)

ax.plot(x, np.sin(x), color="steelblue", label=r"$\sin(x)$", layer=0)
ax.plot(x, np.cos(x), color="tomato", label=r"$\cos(x)$", layer=1)
ax.plot(
    x,
    np.sin(x) * np.cos(x),
    color="seagreen",
    label=r"$\sin(x)\cos(x)$",
    linestyle="dashed",
    layer=2,
)

ax.set_xlabel("x")
ax.set_legend(True)

Show layer 0 only, then layers 0 and 1, then everything:

canvas.show(layers=[0])

Show all layers:

canvas.show()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maxplotlibx-0.1.6.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

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

maxplotlibx-0.1.6-py3-none-any.whl (44.2 kB view details)

Uploaded Python 3

File details

Details for the file maxplotlibx-0.1.6.tar.gz.

File metadata

  • Download URL: maxplotlibx-0.1.6.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for maxplotlibx-0.1.6.tar.gz
Algorithm Hash digest
SHA256 d76f1c0747c068d9f2a5838c9f03792be302e33e550f5371464e038c9ed3a566
MD5 19e56fb25e83d82efcecdb8b2d76dadf
BLAKE2b-256 5f59565b874b5212ccc3a263e2a0252f70c14bf511a3b6825cf1a02e701f8586

See more details on using hashes here.

File details

Details for the file maxplotlibx-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: maxplotlibx-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 44.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for maxplotlibx-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1352323506ad7e47537597ce30dca74e12292a85568c8282387ef4da55c15225
MD5 ef16b137aac5a73a81ed29b445b080ee
BLAKE2b-256 805a421550c291caacfe6983a942dfd9513b53b4aec7e48fdbd4f27b3d09269c

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

This release

0.1.6 This release

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1

2 files

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