Is there a solution to use seaborn with streamlit if my app is blanck using seaborn?

MacOS + streamlit + Python 3.9.

I have an issue using seaborn.

import seaborn as sns
nb_currentprovider = plt.figure(figsize=(10,6))
sns.countplot(x="current_provider",data=df_ventes)
plt.title("Répartition des ventes selon l'opérateur actuel du client", fontsize=14)
plt.xlabel("Volume de ventes", fontsize=12)
plt.ylabel("Opérateur actuel", fontsize=12);
st.pyplot(nb_currentprovider)

My app is blank, I had the same problem with matplotlib but now it is working with:

from matplotlib.backends.backend_agg import RendererAgg
_lock = RendererAgg.lock

Does a similar solution exist for seaborn?

3

1 Answer

Here is an example on windows 10 using seaborn.

Code
import seaborn as sns
import matplotlib.pyplot as plt
import streamlit as st
titanic = sns.load_dataset("titanic")
fig = plt.figure(figsize=(10, 4))
sns.countplot(x="class", data=titanic)
st.pyplot(fig)

Output

enter image description here

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like