Streamlit doesn't show the pattern shapes format of a plotly express bar chart

Hi, i’m trying to create a bar chart for my streamlit app, when i use st.plotly_chart() the graph works with colors but not with pattern shape. when i use fig.show() the pattern shape works but the graph its open in another tab.

        pp_bar = px.bar(pp, x='value', y= 'variable', orientation='h', color='variable', color_discrete_map={"Bajo riesgo": "green", "Alto riesgo": "red"}, pattern_shape="variable", pattern_shape_map={"Bajo riesgo": ".", "Alto riesgo": "/"}, title='Prediction probabilities', hover_data=['variable', 'value'])   
        pp_bar.update_layout(showlegend=False, margin=dict(l=200, r=200, t=200, b=200))
        pp_bar

Hi @Danisr ,

I haven’t checked it, but using st.plotly_chart(pp_bar) might do the trick, let me know :slight_smile:

Best,
Avra

thank you for your answer, but when i use st.plotly_chart(pp_bar) doesn’t show the pattern shape format (pattern_shape_map={“Bajo riesgo”: “.”, “Alto riesgo”: “/”}) :confused:

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