Skip to main content

HTML5 backends for Matplotlib compatible with Pyodide

Project description

matplotlib-pyodide

PyPI Latest Release GHA codecov

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

matplotlib_pyodide-0.2.3.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

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

matplotlib_pyodide-0.2.3-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

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

Hashes for matplotlib_pyodide-0.2.3.tar.gz
Algorithm Hash digest
SHA256 05a0042957f26ac77f824aa3d11ae25f3c0d05f93f78f3ed507d11a577da2ce9
MD5 51c122f05297652572464cf1f0ca07d6
BLAKE2b-256 1af9b5f36d3221e8e211f366544ccc817c61e8f5c2bcc912fe1e1bf9a6044909

See more details on using hashes here.

File details

Details for the file matplotlib_pyodide-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for matplotlib_pyodide-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e0f8c342a038316c89fe8e7a2bcbf4ef11b08344d72cd18ded38a1cddd41c8a6
MD5 f8e3b3e519a5d411ecbe2f05ceeedbfb
BLAKE2b-256 5b9af2d911a8ae68f71366288c54d72271332419c1ed1ced64543d8213d9ff5b

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