Support for Pandas charts?

Hello @GSTREAM welcome to the community!

If I recall, Pandas chart use Matplotlib under the hood (actually you can change the backend on demand but letโ€™s not go there yet)

so you can build the Matplotlib figure, inject it in through the ax attribute of the Pandas charting method, then display it in Streamlit:

fig, ax = plt.subplots()
df.hist(
    bins=8,
    column="Age",
    grid=False,
    figsize=(8, 8),
    color="#86bf91",
    zorder=2,
    rwidth=0.9,
    ax=ax,
)
st.pyplot(fig)

The same trick can be used for Seaborn charts :slight_smile:

fig, ax = plt.subplots()
sns.distplot(df["Age"], ax=ax)
st.pyplot(fig)

and I suppose a lot of Matplotlib wrapper can be displayed this way.

Have a nice day,
Fanilo

5 Likes