✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Python real time data plot

Hi,

I have used plotly for plotting static data from python applications and it has worked well. However I’m not experienced in using plotly.

I have the need to plot real time data as it arrives for a single trace, several times a second from a python program.

I have tried several examples using Dash but these run from a server. These appear to be rather slow, complex and CPU intensive (E.G Live Updates | Dash for Python Documentation | Plotly).

I have also tried using FigureWidget (E.G Plot real-time data) but have not been able to get this to update plots in real time.

Therefore i’m starting to think that plotly is not the best choice for plotting real time data directly from a python program.

The example below is sort of thing that I was hoping for

xValueList = []
xValueList.append(datetime.now())

yValueList = []
yValueList.append(randrange(0,100))

fig = make_subplots(rows=1, cols=2, subplot_titles=("Plot 1", "Unused"))

fig.add_trace(
    go.Scatter(x=xValueList, y=yValueList, name="Rate"),
    row=1, col=1
)
fig.show()
while True:
    xValueList.append(datetime.now())
    yValueList.append(randrange(0,100))
    #Ideally I need some command here to update from the above lists
    sleep(0.3)

If i’ve missed something could someone point me at an example that may suite

Thanks

Paul