Wrong Technology

Use Matplotlib in Nitro apps

Published a new plugin for using Matplotlib plots in Nitro apps: https://github.com/h2oai/nitro-matplotlib

Uses the Anti-Grain Geometry backend, since we're only going to render non-interactive PNG images.

Here's the plugin in action:

Matplotlib Plugin


pip install h2o-nitro-matplotlib


  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:
« A Docker-like thing for apps Use Seaborn in Nitro apps »