Wrong Technology

Use Altair and Vega plots in Nitro apps

Nitro now has a plugin for the excellent Altair package: https://github.com/h2oai/nitro-altair

Makes it easy to render Vega and Vega-Lite visualizations in apps.

Here's the plugin in action:

Altair Plugin

Install

pip install h2o-nitro-altair

Usage

  1. Import the plugin:
from h2o_nitro_altair import altair_plugin, altair_box
  1. Register the plugin:
nitro = View(main, title='My App', caption='v1.0', plugins=[altair_plugin()])
  1. Use the plugin:
# Make a chart:
chart = alt.Chart(data.cars()).mark_point().encode(
x='Horsepower',
y='Miles_per_Gallon',
color='Origin',
).interactive()

# Display the chart:
view(altair_box(chart))

Advanced Usage

You can pass Vega Embed Options to altair_box() for
more control:

altair_box(chart, options=dict(renderer='svg', scaleFactor=2))
« Use Seaborn in Nitro apps Nitrogen - A rough prototype »