Skip to main content

Matplotlib plugin for H2O Nitro

This plugin lets you use Matplotlib and Seaborn visualizations in Nitro apps.

Warning: Try to avoid pyplot in web apps! pyplot maintains references to the opened figures to make show() work, but this will cause memory leaks unless the figures are properly closed1.

Demo

Matplotlib

Matplotlib

View source.

Seaborn

Seaborn

View source.

Install

pip install h2o-nitro-matplotlib

Usage

  1. Import the plugin:
from h2o_nitro_matplotlib import matplotlib_plugin, matplotlib_box
  1. Register the plugin:
nitro = View(main, title='My App', caption='v1.0', plugins=[matplotlib_plugin()])
  1. Use the plugin:
# Make a figure:
x = np.linspace(0, 2, 100)  # Sample data.
fig = Figure()
ax = fig.subplots()
ax.plot(x, x, label='linear')  # Plot some data on the axes.
ax.plot(x, x ** 2, label='quadratic')  # Plot more data on the axes...
ax.plot(x, x ** 3, label='cubic')  # ... and some more.
ax.set_xlabel('x label')  # Add an x-label to the axes.
ax.set_ylabel('y label')  # Add a y-label to the axes.
ax.legend()  # Add a legend.

# Display the figure:
view(matplotlib_box(fig))

Change Log

  • v0.2.1 - Jun 09, 2022
    • Fixed
      • Don't return value from plots.
  • v0.2.0 - May 30, 2022
    • Added
      • Use global pyplot if a figure is not passed (for Seaborn support).
  • v0.1.0 - May 29, 2022
    • Initial Version
  1. See Matplotlib docs on embedding ↩

Metadata

Release files for h2o-nitro-matplotlib 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for h2o-nitro-matplotlib 0.2.2
File Interpreter ABI Platform
h2o_nitro_matplotlib-0.2.2-py3-none-any.whl Python 3 none any Details

Release files / h2o_nitro_matplotlib-0.2.2-py3-none-any.whl

Download URL h2o_nitro_matplotlib-0.2.2-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2c38e7c7c4dc0cdbe9f130dcbbf32a3e1624be6dcc41009304f9d29587d13b8
BLAKE2b-256 checksum
How to use checksums
6589744a06cc934a2e6211243390e84c3337a42aabf5b7a1fe9cff245d3824de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release history Release notifications | RSS feed

This release

0.2.2 This release

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page