I am new to streamlit and python, so sorry if this is a silly mistake. I am trying to produce a dashboard with common filters for different plots. This is the code I have:
# Getting locations locations = sorted(gva_series.ltla22nm.unique()) years = sorted(gva_series.year.unique()) # st.sidebar.markdown("### GDHI") select_dist = st.sidebar.multiselect('District', locations,key='2') select_year = st.sidebar.multiselect('Years', years,key='3') # Graphs gva_series_filt = gva_series[gva_series['ltla22nm'].isin(select_dist) & gva_series['year'].isin(select_year)] fig = px.line(gva_series_filt, x="year", y="GVA", color="ltla22nm", title='GVA per hour') st.plotly_chart(fig) pay_series_filt = pay_series[pay_series['ltla22nm'].isin(select_dist) & pay_series['year'].isin(select_year)] fig = px.line(pay_series_filt, x="year", y="GDHI", color="ltla22nm") st.plotly_chart(fig)
The problem I have is that only the first graph is being affected by the filter, it doesn’t matter which one is first.