streamz icon indicating copy to clipboard operation
streamz copied to clipboard

Streamz + Panel Plotting Issue

Open jsang-scala opened this issue 4 years ago • 2 comments

Im trying to plot a simple chart with streamz + panel in jupyter lab but there seems to be an issue at the end: there is an extra line that goes back to the starting point. This is the code that I wrote and the plot that I get:

beacon_sdf=sDataFrame(example=pd.DataFrame({'interval_duration_sec':[],'sim_time_sec':[]},index=pd.DatetimeIndex([])))

def beacon_Line(beacon_sdf):
    return beacon_sdf.hvplot.line('sim_time_sec','interval_duration_sec')

beacon_Line(beacon_sdf)

hvplot_stream = beacon_sdf.stream.map(beacon_Line)

hvplot_pane = pn.pane.Streamz(hvplot_stream, height=350, always_watch=True,widgets={'Simulation Time(sec)': pn.widgets.FloatSlider})
    
def emit():
    for index,rows in beacon_df.iterrows():
        beacon_sdf.stream.emit(pd.DataFrame({'interval_duration_sec':rows['interval_duration_sec'],'sim_time_sec':rows['sim_time_sec']},index=pd.DatetimeIndex([pd.datetime.now()])))
        sleep(0.01)

hvplot_pane.add_periodic_callback(emit,period=500,timeout=2)
Screen Shot 2020-06-23 at 12 01 37 PM

Does anyone have any thoughts? The source data is not the problem.

jsang-scala avatar Jun 23 '20 16:06 jsang-scala

cc @philippjfr

martindurant avatar Jun 23 '20 16:06 martindurant

@philippjfr could you help on this? Thanks!

jsang-scala avatar Jun 24 '20 22:06 jsang-scala