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_backendwhich from allows rendering the Agg buffer as static images into an HTML canvas - an interactive HTML5 canvas backend
html5_canvas_backenddescribed 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file matplotlib_pyodide-0.2.3.tar.gz.
File metadata
- Download URL: matplotlib_pyodide-0.2.3.tar.gz
- Upload date:
- Size: 3.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05a0042957f26ac77f824aa3d11ae25f3c0d05f93f78f3ed507d11a577da2ce9
|
|
| MD5 |
51c122f05297652572464cf1f0ca07d6
|
|
| BLAKE2b-256 |
1af9b5f36d3221e8e211f366544ccc817c61e8f5c2bcc912fe1e1bf9a6044909
|
File details
Details for the file matplotlib_pyodide-0.2.3-py3-none-any.whl.
File metadata
- Download URL: matplotlib_pyodide-0.2.3-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0f8c342a038316c89fe8e7a2bcbf4ef11b08344d72cd18ded38a1cddd41c8a6
|
|
| MD5 |
f8e3b3e519a5d411ecbe2f05ceeedbfb
|
|
| BLAKE2b-256 |
5b9af2d911a8ae68f71366288c54d72271332419c1ed1ced64543d8213d9ff5b
|