Is is available to plot real-time data?

Hi, thanks for this fancy package.

I’m new to this package and try to create a live plot using real-time measured data collected from hardware based on my research project. Some real-time graphs, a few buttons to communicate with hardware.

Is it possible to implement these using this package? I know it’s tangible using LabView, but can I use this package instead?

I try a few tutorials but cannot find a real-time plot demonstration. Any suggestion is appreciated. Thank you very much!

2 Likes

Hi @HotPotPanda and welcome to the forum! Yes it is possible. If you want to drop real time data to your graph, you must use our add_rows function.

df1 = pd.DataFrame(np.random.randn(50, 20), columns=('col %d' % i for i in range(20)))

my_table = st.table(df1)

df2 = pd.DataFrame( np.random.randn(50, 20), columns=('col %d' % i for i in range(20)))

my_table.add_rows(df2)
# Now the table shown in the Streamlit app contains the data for
# df1 followed by the data for df2.

If you want to update any other kind of widget, I recommend putting that widget inside a loop and refreshing it with new data.

Hope this helps and let us know if you need any additional help!