Seanborn Doesnt render faster-Is too slow on streamlit

Dear Streamlit Community,

Please which is the best chart to use with streamlit…I have tried seaborn and other charts but seaborn seems to be very slow with streamlit…orendously slow.

Kindly help out

Hello @kareemrasheed89

There was a small benchmark done by @theimposingdwarf here: Plot Library Speed Trial that suggests using Altair or Plotly rather than seaborn/matploblib. You could try those.

If you are able to share a code snippet maybe we can see if there’s a way to optimize the seaborn part too.

Have a nice day,
Fanilo :balloon:

1 Like

Many thanks @andfanilo I have read many of articles in this community but I for my case, seaborn is the best i can use for heatmap…in my app, i have mixture of plotly and seaborn but it takes longer than expected to render.

columns=[' OOS/premier_milk___honey___175g',' OOS/premier_aloevera___glyc___175g',' OOS/premier_rose_water___glyc___175g',	 ' OOS/premier_shear_butter___glyc___175g',
        ' OOS/premier_lemon___glyc___175g', ' OOS/premier_lemon___glyc___60g',	 ' OOS/prem_cool_ult____65g',	 ' OOS/prem_cool_sport___65g',	 ' OOS/prem_cool_o__def___65g',
        ' OOS/prem_cool_ult____110g',	 ' OOS/prem_cool_sport___110g',	' OOS/prem_cool_o__def___110g', ' OOS/carex_soap___110g',
        ' OOS/carex_soap___70g', ' OOS/joy_skin_care_soap__tender____150g']
        col1, col2, col3=st.columns([2,0.1,2])
        w_dataoos1=w_data[columns]
        fig=plt.figure(figsize=(10,15))
        sns.heatmap(data=w_dataoos1, annot=True)
        plt.title("Antiseptic/Fragrance Soaps In Last 3Months[retailscope]")
        col1.pyplot(fig)
        columns=[' OOS/joy_skin_care_soap__exfoliating____150g',	 ' OOS/joy_skin_care_soap__tender____70g',
        ' OOS/imp__leather_classic___150g', ' OOS/imp__leather_classic___60g',	 ' OOS/prem_asl_ori__250ml___250ml',	 ' OOS/prem_asl_lf_250ml___250ml',
        ' OOS/prem_asl_ori__500ml___500ml',	 ' OOS/prem_asl_lf_500ml___500ml',	 ' OOS/carex_hwl_moisture_plus___250ml',	 ' OOS/carex_hwl_complete_protect___250ml',
        ' OOS/carex_hwl_herbal_protect___250ml',	 ' OOS/carex_hand_sanitizer___100ml',	 ' OOS/carex_hand_sanitizer___400ml']
        w_dataoos2=w_data[columns]
        fig2=plt.figure(figsize=(10,15))
        sns.heatmap(data=w_dataoos2, annot=True)
        plt.title("Antiseptic/Fragrance Soaps In Last 3Months[retailscope]")
        col3.pyplot(fig2)

I will be happy to get any help to render faster, also i thought of caching by using @st.cache.

Not sure of best way thou