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.
Metadata
Release files for html-plot 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| html_plot-0.1.4.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| html_plot-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.2 kB
Release files / html_plot-0.1.4.tar.gz
| Download URL | html_plot-0.1.4.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba48d4a50b280ffc4d86f2ff350c2c086e92e95e8317e9b8f93da7afa9a5f528
|
|
BLAKE2b-256 checksum How to use checksums |
1a7e129af2f46efd94f351bf42ddf9efa6d68f0f6a1290aa190a86312991dbb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-72-generic
|
Release files / html_plot-0.1.4-py3-none-any.whl
| Download URL | html_plot-0.1.4-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f56f56bb34c0cb69f1b735f761c98770f1b51f9b395790b0da7ad55df8818aaa
|
|
BLAKE2b-256 checksum How to use checksums |
01d9218c7230ca88cd880bbc96a1dfd319a71e38d77daf5e3a542e7dc41ff0ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-72-generic
|