HTML5 backends for Matplotlib compatible with Pyodide
Project description
matplotlib-pyodide
HTML5 backends for Matplotlib compatible with Pyodide
This package includes two matplotlib backends,
- the
wasm_backend
which from allows rendering the Agg buffer as static images into an HTML canvas - an interactive HTML5 canvas backend
html5_canvas_backend
described in this blog post
Installation
This package will be installed as a dependency when you load matplotlib
in Pyodide.
Usage
To change the backend in matplotlib,
- for the wasm backend,
import matplotlib matplotlib.use("module://matplotlib_pyodide.wasm_backend")
- for the interactive HTML5 backend;
import matplotlib matplotlib.use("module://matplotlib_pyodide.html5_canvas_backend")
By default, matplotlib figures will be rendered inside a div that's appended to the end of document.body
.
You can override this behavior by setting document.pyodideMplTarget
to an HTML element. If you had an HTML
element with id "target", you could configure the backend to render visualizations inside it with this code:
document.pyodideMplTarget = document.getElementById('target')
For more information see the matplotlib documentation.
License
pyodide-cli uses the Mozilla Public License Version 2.0.
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
Built Distribution
File details
Details for the file matplotlib-pyodide-0.2.2.tar.gz
.
File metadata
- Download URL: matplotlib-pyodide-0.2.2.tar.gz
- Upload date:
- Size: 3.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f285208e891112d30e3825bb5a6f5c3a846a5f4080460a518962e2d73aa325 |
|
MD5 | 0a4fe06d02efc401cae39ee6ff21f357 |
|
BLAKE2b-256 | 5e1d7b706e1f529b055a975d359ac3357c0257260a77ab75744c34f35e51b7d6 |
File details
Details for the file matplotlib_pyodide-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: matplotlib_pyodide-0.2.2-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 712a1bd8a06875393f25b0dc7a35cff1ecde2df36446d1290aaa846fd225a5df |
|
MD5 | a89148f54a348f992d2e0d03e0225840 |
|
BLAKE2b-256 | 368ef28cdc02d2eb5d9a711876c39be72701b09ec80ce9ea3a6b67a7f08d8212 |