Seaborn

Hi community,
I have a question about using seaborn in streamlit. I would like to display two heatmap side by side with heatmap. Here is the code :

fig, (ax, ax2) = plt.subplots(figsize = (9,6), ncols =2)

sns.heatmap(x_df[["coefficients", "Commune"]].set_index("Commune").head(10), annot = True, cmap ="Greens",
            linewidths = 2, ax=ax)
ax.set_title("Investir", fontsize = 15)
ax.set_ylabel('')

st.pyplot(fig)

sns.heatmap(x_df[["coefficients", "Commune"]].set_index("Commune").tail(10), annot = True, cmap ="Reds_r",
            linewidths = 2, ax=ax2)
ax2.set_title("Ne pas investir", fontsize = 15)
ax2.set_ylabel('')

st.pyplot(fig)

But Streamlit doesn’t display it as in a Notebook. It display a 2 fig with two columns and each heatmap is in a different fig, one under the other one.

Any idea of why ?

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