Skip to main content

D3 Viewer for Matplotlib

Project description

mpld3: A D3 Viewer for Matplotlib

This is an interactive D3js-based viewer which brings matplotlib graphics to the browser. Please visit http://mpld3.github.io for documentation and examples.

You may also see the blog post, or the IPython notebook examples available in the notebooks directory of this repository.

version status downloads build status

About

mpld3 provides a custom stand-alone javascript library built on D3, which parses JSON representations of plots. The mpld3 python module provides a set of routines which parses matplotlib plots (using the mplexporter framework) and outputs the JSON description readable by mpld3.js.

Installation

mpld3 is compatible with python 2.6-2.7 and 3.3-3.4. It requires matplotlib version 2.2.2 and jinja2 version 2.7+.

Optionally, mpld3 can be used with IPython notebook, and requires IPython version 1.x or (preferably) version 2.0+.

This package is based on the mplexporter framework for crawling and exporting matplotlib images. mplexporter is bundled with the source distribution via git submodule.

Within the git source directory, you can download the mplexporter dependency and copy it into the mpld3 source directory using the following command:

$ python setup.py submodule

The submodule command is not necessary if you are installing from a distribution rather than from the git source.

Once the submodule command has been run, you can build the package locally using

$ python setup.py build

or install the package to the standard Python path using:

$ python setup.py install

Or, to install to another location, use

$ python setup.py install --prefix=/path/to/location/

Then make sure your PYTHONPATH environment variable points to this location.

Trying it out

The package is pure python, and very light-weight. You can take a look at the notebooks in the examples directory, or run create_example.py, which will create a set of plots and launch a browser window showing interactive views of these plots.

For a more comprehensive set of examples, see the IPython notebook examples available in the notebooks directory.

Test Plots

To explore the comparison between D3 renderings and matplotlib renderings for various plot types, run the script visualize_tests.py. This will generate an HTML page with the D3 renderings beside corresponding matplotlib renderings.

Features

Many of the core features of matplotlib are already supported. And additionally there is some extra interactivity provided via the plugin framework. The following is a non-exhausive list of features that are yet to be supported:

  • tick specification & formatting
  • some legend features
  • blended transforms, such as those required by axvlines and axhlines
  • twin axes (i.e. multiple scales on one plot) tied together

If any of these look like something you'd like to tackle, feel free to submit a pull request!

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

mpld3-0.5.7.tar.gz (2.3 MB view details)

Uploaded Source

Built Distributions

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

mpld3-0.5.7-py3.9.egg (306.1 kB view details)

Uploaded Egg

mpld3-0.5.7-py3-none-any.whl (201.0 kB view details)

Uploaded Python 3

File details

Details for the file mpld3-0.5.7.tar.gz.

File metadata

  • Download URL: mpld3-0.5.7.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for mpld3-0.5.7.tar.gz
Algorithm Hash digest
SHA256 c589db8b661aee25c93e198e2e18ed47b9a96951de41d96241345acec5f819ab
MD5 d84e5c4087c3b288470dc00f4a55598a
BLAKE2b-256 9e0f923d60947e9fa7303bc22fc241c61705cc3051622d9247f576ef2bdd6d80

See more details on using hashes here.

File details

Details for the file mpld3-0.5.7-py3.9.egg.

File metadata

  • Download URL: mpld3-0.5.7-py3.9.egg
  • Upload date:
  • Size: 306.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for mpld3-0.5.7-py3.9.egg
Algorithm Hash digest
SHA256 b1290f6cca2d9515e32ee21a8b0c18b2ea361cefce58ba0f4df881e9eeb3f64c
MD5 2e63c652f37fecca95a70c8b39036f89
BLAKE2b-256 b25061326f20a8782d5bf61a848078f2e91353d74debb854879ceb84abe4e667

See more details on using hashes here.

File details

Details for the file mpld3-0.5.7-py3-none-any.whl.

File metadata

  • Download URL: mpld3-0.5.7-py3-none-any.whl
  • Upload date:
  • Size: 201.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for mpld3-0.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3626d37da7ac11d0fce4dd5ceb37d04ba618bf951129bf6ca3f94bf48da87d6f
MD5 622fabd800c26064ad53caaf3d0477e5
BLAKE2b-256 9e383cba20b12e7e06ec82fa57a9b6cde363903350b6b54754902acf2673c46b

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