我用 streamlit 創建了一個比較應用程式,我想動態比較它。
這是我寫的代碼
import streamlit as st
import matplotlib.pyplot as plt
import pandas as pd
sampel_data={'Company':['A','B','C','D','E','F','G','H','I','J'],
'Profit':[3,4.5,2,2.5,1.25,3,3.25,5,6,2.75]}
df_sampel=pd.DataFrame(data=sampel_data)
st.dataframe(df_sampel)
option1=st.multiselect("Choose company to compare",df_sampel)
st.write(len(option1))
fig,ax=plt.subplots()
plt.bar(option1,height=10)
st.pyplot(fig)
我的問題是如何顯示利潤,因為 x/水平部分顯示正確,但是在顯示 y/垂直部分時,顯示不正確。
uj5u.com熱心網友回復:
你的身高引數是錯誤的。看看這里
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/457260.html
標籤:Python 熊猫 matplotlib 流线型
上一篇:如何在直方圖中添加范圍?
