Skip to main content

Functions for creating HTML objects out of Matplotlib plots in Jupyter

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.

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)

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.1.tar.gz (2.1 kB view hashes)

Uploaded Source

Built Distribution

html_plot-0.1.1-py3-none-any.whl (2.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page