'Python streamlit dynamic filter
I try to do a dashboard with streamlit, but I do not succeed to impact the graph with the filter. You can see what i did below :
year = st.sidebar.multiselect(
"select the year : ",
options=df2["Year"].unique(),
default=df2["Year"].unique(),
)
df_selection = df2.query("Year == @year")
fig = px.bar(df2, x="dpe", y="Percentage", color="signature",title="<b> DPE repartition in function of the year <b>")
fig.update_layout(plot_bgcolor="rgba(0,0,0,0)")
If you have any solution for this problem let me know thanks in advance.
Solution 1:[1]
You need to use st.plotly_chart() to display your bar graph.
try adding the following after
fig.update_layout(plot_bgcolor="rgba(0,0,0,0)")
st.plotly_chart(fig)
this should resolve the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | micro5 |
