I am trying to show the plot generated using dabl library in streamlit app, but with the following code, I am getting only one plot. Can you please help me understand how to show all the plots generated using dabl on streamlit app.
import streamlit as st
import pandas as pd
import dabl
df= pd.read_csv("spambase.csv")
dabl.plot(df, "spam")
st.pyplot()
import streamlit as st
import pandas as pd
import dabl
import matplotlib.pyplot as plt
df = pd.read_csv("spambase.csv")
figures = dabl.plot(df, "spam")
if isinstance(figures, list):
for fig in figures:
st.pyplot(fig)
else:
st.pyplot(figures)
I believe this one should work as expected – Let me know.
Ohh I don’t have access to my laptop now to check, but we may need to ensure that the correct type (Figure) is passed to st.pyplot, preventing the “AttributeError.” Something like this might work:
import streamlit as st
import pandas as pd
import dabl
import matplotlib.pyplot as plt
df = pd.read_csv("spambase.csv")
plots = dabl.plot(df, "spam")
if isinstance(plots, list):
for ax in plots:
st.pyplot(ax.figure)
else:
st.pyplot(plots.figure)
Let me know if that solution works. I should be able to have a closer look at the issue shortly once I’m back in front of my screen!