Skip to main content

WebWorker backend 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_worker_contrib-1.0.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.

File details

Details for the file matplotlib_pyodide_worker_contrib-1.0.3.tar.gz.

File metadata

File hashes

Hashes for matplotlib_pyodide_worker_contrib-1.0.3.tar.gz
Algorithm Hash digest
SHA256 c3cb2cdda6c56114d3cf30ed4a901106923cd4fbec1d974ac3222b08844a47ab
MD5 537f4047067b4df95a853ba17e26a4f9
BLAKE2b-256 869f8b2914664d90d89bbbbe2ab3fb9b1b8f4ff591ae3545b9249c23d00fcb0d

See more details on using hashes here.

File details

Details for the file matplotlib_pyodide_worker_contrib-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for matplotlib_pyodide_worker_contrib-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c0eb3b6889dd4a723537901deebc5ea8be58ec6073a69cc1d024b3c35eab7939
MD5 b56bb3b868de9a6aa2d09b87cdef1295
BLAKE2b-256 1e861a14939d2cfcbcc9e4ac59cbba705e9df0e59d9a00c87aec56e82163b1c7

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