Updating graph with Plotly streaming does not render properly


I am using plotly 2.0
I have attached my code in a notebook.
Basically I am trying to plot 2 separate streams of data in a scatter graph.

The data is such that the x values for stream 1 (user 1 stream in the screenshot) appear ahead of those of stream 2.
As the graph updates, attempting to connect the lines in the graph there is a bug because the lines go backwards, seems to do with the way the graph is scaling up.

Here is an example of the graph updating:

I have attached my code as a notebook.

I am not sure how to fix this.


Any suggestions please?


Hi @nds,

I think the problem is that your strings are not recognized as dates and so they are being treated as categorical as categorical. Try passing datetime.datetime objects as the x and y to stream.write. You can convert your strings to datetime objects using the datetime.datetime.strptime static method (See https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime).

Hope that helps!


Hi Jon,
That seems to have worked, setting the x value to the timestamp and using the timestamp as the id as well.
Thank you!

1 Like