Display plotly_chart throws error

Hi Folks,

probably this is super silly question but anyways.
I wanted to display a histogramm so i used the inbuild function from pandas:

 ax = df["value"].plot.hist(bins=12)
st.plotly_chart(ax.figure, use_container_width=True)

I get:
AttributeError: 'XAxis' object has no attribute '_gridOnMajor'

However, if i use st.write(ax.figure) it works fine.
What is going wrong here?

Hey @chris_klose,

Ah Pandas my nemesis :panda_face: :joy:

Ok so weirdly I am running into a similar problem. this bit of code i made, works for the st.write() call but throws a AttributeError: 'Spine' object has no attribute 'is_frame_like' when i use the plotly chart option:

data = pd.DataFrame([[1,2,3],[4,5,6]], columns=["value","col1","col2"])

ax = data["value"].plot.hist()
st.write(ax.figure) <-- this is good 
st.plotly_chart(ax.figure, use_container_width=True) <-- this is bad

I haven’t missed any figure creating have I? (like fig = plt.subplot(etc…))


1 Like