Interactive Charts in Jupyter Notebooks
Jupyter is where most analysis starts. Vizly charts render inline automatically because chart objects implement _repr_html_(). Create a chart, and it displays in the cell output. No special display calls, no magic.
Basic inline chart
import vizly as vz
data = [
{"date": "2026-01-01", "revenue": 42},
{"date": "2026-01-02", "revenue": 48},
{"date": "2026-01-03", "revenue": 45},
]
vz.set_theme("corporate")
vz.line(data, x="date", y="revenue", title="Revenue")
The chart appears below the cell, fully interactive: tooltips, zoom, and legend toggles all work in the notebook output.
Choosing a theme per chart
You can set a session theme, or override it per chart with the theme= kwarg.
vz.set_theme("dark")
vz.bar(data, x="date", y="revenue", title="Dark theme")
vz.bar(data, x="date", y="revenue", title="Editor theme", theme="editor_tokyo_night")
Working with pandas
Pass DataFrames directly to chart factories. This is the natural notebook flow: load, transform, chart.
import pandas as pd
import vizly as vz
df = pd.DataFrame({
"date": ["2026-01-01", "2026-01-02", "2026-01-03", "2026-01-04", "2026-01-05"],
"revenue": [42, 48, 45, 61, 58],
"cost": [18, 20, 19, 24, 22],
})
vz.line(df, x="date", y=["revenue", "cost"], title="Revenue vs cost")
Capturing the HTML for reuse
If you need the raw HTML instead of relying on inline display, call to_html() or write it to a file with render().
html = chart.to_html()
chart.render("chart.html") # writes a self-contained file
SQL directly in a notebook
Use from_sql to pull data into a chart without manual DataFrames.
from sqlalchemy import create_engine
engine = create_engine("sqlite:///sales.db")
table = vz.from_sql("SELECT region, SUM(sales) AS sales FROM orders GROUP BY region", bind=engine)
vz.bar(table, x="region", y="sales", title="Sales by region")
Comparing several charts in one cell
For a quick comparison view, compose charts into a grid or tab layout and display it as one output.
vz.set_theme("corporate")
chart = vz.grid(
charts=[
vz.bar(df, x="date", y="revenue", title="Revenue"),
vz.line(df, x="date", y="cost", title="Cost"),
],
title="Comparison",
)
chart # renders as one grid in the cell
Tips
| Tip | Detail |
|---|---|
| Just create the chart | A chart object as the last expression in a cell renders automatically. |
| Set a session theme | vz.set_theme("dark") once at the top of the notebook applies to all later charts. |
| Compose for comparisons | vz.grid and vz.tab let several charts share one cell output and one ECharts load. |
| Save to HTML | Use chart.render("out.html") to export any notebook chart for sharing or embedding. |