Код: Выделить всё
import streamlit as st
import plotly.express as px
import pandas as pd
# this is needed to write_html correctly
import plotly.io as pio
pio.templates.default = "plotly"
df = pd.DataFrame({
'Fruit': ['Apples', 'Apples', 'Oranges', 'Oranges'],
'Amount': [10, 15, 20, 25],
'City': ['SF', 'NY', 'SF', 'NY']
})
fig = px.bar(df, x='Fruit', y='Amount', color='City')
fig.update_layout(barmode='stack')
print("SAVE IMAGE")
fig.write_html("test.html")
st.plotly_chart(fig)
То, что он выглядит, когда я использую, в потоковой установке в потоковом потоке Окружающая среда: < /p>
Код: Выделить всё
.\.venv\Scripts\streamlit.exe run .\streamlit_test.py
Однако, когда я запускаю его из глобально установленного потока, стержни не сложены.
Код: Выделить всё
C:\Users\my_username\AppData\Local\Programs\Python\Python312\Scripts\streamlit.exe run .\streamlit_test.py
График не отображается в виде сложенного Barplot, но стержни рядом друг с другом.
Подробнее здесь: https://stackoverflow.com/questions/796 ... al-install