When rendering a plotly barplot with fig.show()
, I get the plot exactly the way I developed it. But when I render it using streamlit’s st.plotly_chart()
, it gets with another appearance (without the bar labels).
This is how it should be (the plot I get when using fig.show()
):
And how it renders with st.plotly_chart()
(it is in dark theme, but the problem also occurs in light theme):
My code:
import pandas as pd
import streamlit as st
import plotly.express as px
df = pd.read_excel('file.xlsx', sheet_name='Current_Base')
fig = px.histogram(df,
x='number',
text_auto=True
)
fig.show()
st.plotly_chart(fig)
My relevant settings:
- os: macOS Monterey 12.1
- libs:
streamlit 1.3.1
plotly 5.5.0
Could anyone help me with this issue?
(I also posted it in stack overflow)