D3 Viewer for Matplotlib
Project description
mpld3: A D3 Viewer for Matplotlib
- Maintainers: @vladh, @cliffckerr
- Status: I (@vladh) am not currently able to dedicate much time to resolving mpld3 issues. However, I will gladly look at your pull request and review it. Please try your hand at fixing any issues you may have and sending a PR rather than just filing an issue — most problems don't take as long as you might expect to figure out!
- Original author: Jake Vanderplas jakevdp@cs.washington.edu
- License: BSD 3-clause
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.
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 -m build
or install the package to the standard Python path using:
$ pip install .
Or, to install to another location, use
$ pip 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
andaxhlines
- 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
Release history Release notifications | RSS feed
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 mpld3-0.5.10.tar.gz
.
File metadata
- Download URL: mpld3-0.5.10.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a478eb404fa5212505c59133cf272cd9a94105872e605597720e7f84de38fbc7 |
|
MD5 | 592aa84de0598d3f165a8a20b69bacaf |
|
BLAKE2b-256 | 905819378f4189a034eb3efc17b133426b8551af1d3b2c70d641a63124579629 |
File details
Details for the file mpld3-0.5.10-py3-none-any.whl
.
File metadata
- Download URL: mpld3-0.5.10-py3-none-any.whl
- Upload date:
- Size: 202.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80877acce87ea447380fad7374668737505c8c0684aab05238e7c5dc1fab38c1 |
|
MD5 | 2d03b13858fd2dc11a118d52f1951eb2 |
|
BLAKE2b-256 | 956ae3691bcc47485f38b09853207c928130571821d187cf174eed5418d45e82 |