Can I display Plotly Dash graphs on Streamlit?

I want to use Dash to make charts and tables and display them on my Streamlit Dashboard.

I’m currently using Plotly Graph Objects (go.Table to make tables) but I would like to try using Dash to make the tables but display them on my Streamlit dashboard.

Is that possible or does Dash only work as a dashboard of its own?

Hello

Yes it is possible with plot.ly charts

Dash is a framework comparable to streamlit
plot.ly is a charting library
the python version being a wrapper around the JS version.
Plot.ly and Dash come from same team.

plotly express is also great for simpler charts

here is some code from my app that uses plotly express
sunburst = px.sunburst(df, path=[px.Constant(“all”), “labs”], values=df[“nbr”])
st.plotly_chart( sunburst )

or just have sunburst in the line and streamlit will deal with it.

How about a table? I’m trying to display a dash_table.DataTable() on Streamlit, but I don’t know how to actually display it.

I have tried:

  1. st.write(my_dash_table) but it prints out the pd.DataFrame() in written.
  2. st.table(my_dash_table) but it displays an “empty” table.

Also, will the table be interactive just like in a Dash app?

I’d say, make a choice, its either Dash or Streamlit.
Dash is a framework.
When you have

app = Dash(__name__)

, it starts a server.

PLOTLY charts are also interactive (zooming etc…)

St provides quickness, Dash allows more control over layout

Gotcha.

It’s just because I want Dash’s conditional formatting flexibility but want to have my table on Streamlit.

Doesn’t seem possible since DataTable is not an object that st.table() nor st.dataframe() take as input.

Hi @Luiz_Scheuer ,

would it be possible to do st.plotly_chart(your_dash_table)?

St.table is supposed to be a dataframe that is noninteractive.

Tried it, got this: as expected, streamlit does not have DataTable objects as inputs for its functions.

_plotly_utils.exceptions.PlotlyError: The figure_or_datapositional argument must bedict-like, list-like, or an instance of plotly.graph_objs.Figure

Ah dang it! It seems like we don’t support dash tables. I didn’t realize that plotly tables are different from dash tables!

I think Plotly tables should work though but I know that’s not particularly useful information for you :frowning:

No problem: looking for a couple of things: easier conditional formatting and fix columns like in Excel, since my table has many columns.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.