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.5.tar.gz (39.6 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.5-py3-none-any.whl (43.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for maxplotlibx-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6bcfd298a7fb4786e11631ad44e26e62e63c87f44fac7b8520682aaf3ee6ccdd
MD5 d361b796bf0c6ee154f0af14f3ce872f
BLAKE2b-256 8c791f0f5188b77191e04e354cfd32197315eee91bf131dce02675dcf4432f57

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for maxplotlibx-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 447c6ec74ee38473cace4aa9ec96e2ec7d772e5d6242930a7ced039d096318d4
MD5 0ec4d84f4f5caf1b20cc1ebb36915829
BLAKE2b-256 08db26412b242b689ead46a428366029b57decf45aa0e77724eca40a9b5e438e

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

0.1.6

2 files

This release

0.1.5 This release

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