Skip to main content

Render Matplotlib plots as HTML objects in Jupyter, so that they can be placed in HTML tables, downloaded on click, and more

Project description

This package can be used to render Matplotlib plots as HTML objects in Jupyter, so that they can be placed in HTML tables, downloaded on click, and more.

Installation

pip install html_plot

Examples

import pandas as pd
my_plot = pd.DataFrame([[1,2,3],[4,5,6]]).plot()

Simple usage

html_plot.display(my_plot)

Advanced usage

Adjust Figure and Axes (e.g. figsize, title)

plot_dim = html_plot.get_dim(my_plot.get_figure())
plot_dim.figsize *= 1.5
ax = html_plot.ax("This is my plot", **plot_dim)
my_html_plot = pd.DataFrame([[1,2,3],[4,5,6]]).plot(ax=ax)

Output HTML string

html_str = html_plot.html_str(my_html_plot)
print(html_str)

Output an IPython.display.HTML object

import IPython.display
html_obj = html_plot.HTML(my_html_plot)
IPython.display.display(html_obj)

Display the object using a wrapper for IPython.display.display()

html_plot.display(my_html_plot)

Licence

This work is dual-licensed under the Open Software License 3.0 and the Affero GNU General Public License 3.0. You can choose one of them if you use this work.

SPDX-License-Identifier: OSL-3.0 OR AGPL-3.0-or-later

  • The primary, more permissive licence is OSL-3.0, which allows the package to be used in any software project, regardless of the project's licence (open or closed source, commercial or non-commercial).
  • If you distribute software that uses a modified version of this package, the licence requires you to release only the code of the modified package, not the whole software project.
  • You are very welcome to do the above in the form of pull requests.
  • In other words, it's a reasonable, LGPL-like weak copyleft that doesn't try to infect all your software with a particular licence.
  • See the explanation and rationale for OSL-3.0 written by the author of the licence.
  • The alternative licence is AGPL-3.0, which allows the package to be combined with GPL-3.0 code.
  • Under both OSL-3.0 and AGPL-3.0, the aforementioned weak copyleft is also triggered by using the software over a network. In today's age of web apps, it makes no sense to have different terms depending on the technical details of how the software interacts with the user (locally or over a network). It's surprising how few open-source licences have caught up with the times.

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

html_plot-0.1.4.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

html_plot-0.1.4-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file html_plot-0.1.4.tar.gz.

File metadata

  • Download URL: html_plot-0.1.4.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-72-generic

File hashes

Hashes for html_plot-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ba48d4a50b280ffc4d86f2ff350c2c086e92e95e8317e9b8f93da7afa9a5f528
MD5 40eec05aafcf38acd081ae89b8cdb2d8
BLAKE2b-256 1a7e129af2f46efd94f351bf42ddf9efa6d68f0f6a1290aa190a86312991dbb9

See more details on using hashes here.

File details

Details for the file html_plot-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: html_plot-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-72-generic

File hashes

Hashes for html_plot-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f56f56bb34c0cb69f1b735f761c98770f1b51f9b395790b0da7ad55df8818aaa
MD5 90de5c140f8e945bab752997f1d8a0ae
BLAKE2b-256 01d9218c7230ca88cd880bbc96a1dfd319a71e38d77daf5e3a542e7dc41ff0ce

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