Tabs do not work with plotly_events?

When i try to make tabs containing boxplots from plotly_events, it renders first time, but once I click on a boxplot, the plots on other tabs disappear. However, it works fine using st.plotly_chart(but it does not have click event, which causes the issue)

Here’s a simple example of the issue:

def render_test(df):
    tab1, tab2 = st.tabs(["Tab1", "Tab2"])
    tab_content = get_tab_boxplot_content(df)
    with tab1:
        fig =[0]['main'], x='parent_group_name', y='total_quantity')
    with tab2:
        fig2 =[1]['main'], x='parent_group_name', y='total_quantity')

The other function get_tab_boxplot_content is just for extracting the right data for each tab, but should not be relevant for the issue and could be any data, although i will put it here in case:

def get_tab_boxplot_content(df: pd.DataFrame):
    groups = sorted(list(df['parent_group'].unique()))[0:4]
    content = []
    for group in groups:
                        'main':df.loc[df['parent_group'] == group],
                        'sub':df.loc[df['parent_group'] == group] })
    return content

It renders fine first time, and you can switch between the tabs. But once you do a click event, boxplots from other tabs disappear. Am i the only one with this issue or do you have any suggestions as to why this is happening?

Apparently downgrading to streamlit 1.14.0 helped with the issue. Not a very good solution, but it works. Hoping for a compatibility update between newer streamlit versions and plotly_events.

Hi @s214606

Thanks for the question and your solution. It does appear to be a compatibility issue with the versions, would you like to report a GitHub issue here.

Best regards,

1 Like

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