Streamz + Panel Plotting Issue

Open
#344 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
jupyter-notebook, pandas, python

Research direction

Start by running the supplied Streamz and Panel plotting example in JupyterLab and compare its output with the attached screenshot. Trace the stream update and line-plot rendering path to identify why an extra line returns to the starting point; done means the reproduced chart no longer contains that line.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
1.3k
Forks
149
Avg merge
17h 39m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-streamz/streamz

All issues in python-streamz/streamz

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.