Streaming Perspective#
Download this notebook from GitHub (right-click to download).
import numpy as np
import pandas as pd
import panel as pn
pn.extension('perspective', sizing_mode='stretch_width')
This example demonstrates the powerful streaming capabilities of the Perspective
pane.
df = pd.DataFrame(np.random.randn(10, 4), columns=list('ABCD')).cumsum()
rollover = pn.widgets.IntInput(name='Rollover', value=15)
perspective = pn.pane.Perspective(
df, sizing_mode='stretch_width', height=400, theme='material-dark'
)
def stream():
data = df.iloc[-1] + np.random.randn(4)
perspective.stream(data, rollover=rollover.value)
cb = pn.state.add_periodic_callback(stream, 50)
component = pn.Column(
pn.Row(cb.param.period, rollover, perspective.param.theme),
perspective,
pn.layout.HSpacer(height=35), # Needed if user selects vaporwave theme in template
)
component
App#
Lets wrap it into nice template that can be served via panel serve streaming_perspective.ipynb
pn.template.FastListTemplate(
site="Panel",
title="Streaming Perspective",
main=[
"This example demonstrates the **powerful streaming capabilities** of Panel and the `Perspective` pane.",
component,
]
).servable();
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.
Download this notebook from GitHub (right-click to download).