GarGerry commited on
Commit
982cc21
·
verified ·
1 Parent(s): 1775480

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -100,7 +100,13 @@ if st.button("Analisis Portofolio"):
100
  # Pie Chart dengan filter saham dengan bobot signifikan
101
  filtered_weights = {k: v for k, v in portfolio_weights.items() if v > 0.01}
102
  fig, ax = plt.subplots()
103
- ax.pie(filtered_weights.values(), labels=filtered_weights.keys(), autopct='%1.1f%%', startangle=140)
 
 
 
 
 
 
104
  ax.axis('equal')
105
  st.pyplot(fig)
106
 
@@ -134,4 +140,4 @@ if st.button("Analisis Portofolio"):
134
  - **Pemilihan Portofolio Terbaik**: Portofolio di frontier efisien memberikan return terbaik untuk tingkat risiko tertentu.
135
  """)
136
  else:
137
- st.error("Optimasi portofolio gagal. Coba dengan saham yang berbeda.")
 
100
  # Pie Chart dengan filter saham dengan bobot signifikan
101
  filtered_weights = {k: v for k, v in portfolio_weights.items() if v > 0.01}
102
  fig, ax = plt.subplots()
103
+ ax.pie(
104
+ filtered_weights.values(),
105
+ labels=filtered_weights.keys(),
106
+ autopct=lambda p: f'{p:.1f}%' if p > 1 else '', # Hanya tampilkan jika > 1%
107
+ startangle=140,
108
+ pctdistance=0.85 # Mengatur jarak label agar lebih terlihat
109
+ )
110
  ax.axis('equal')
111
  st.pyplot(fig)
112
 
 
140
  - **Pemilihan Portofolio Terbaik**: Portofolio di frontier efisien memberikan return terbaik untuk tingkat risiko tertentu.
141
  """)
142
  else:
143
+ st.error("Optimasi portofolio gagal. Coba dengan saham yang berbeda.")