Spaces:
Runtime error
Runtime error
Commit
·
d76af9e
1
Parent(s):
796c7fd
Update app.py
Browse files
app.py
CHANGED
@@ -163,12 +163,16 @@ def tweets_localidad(buscar_localidad):
|
|
163 |
muestra = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
|
164 |
with col2:
|
165 |
resultado = df['Prediccion'].value_counts()
|
|
|
|
|
|
|
|
|
166 |
colores=["#EE3555","#aae977"]
|
167 |
fig, ax = plt.subplots()
|
168 |
-
fig.set_size_inches(
|
169 |
-
plt.pie(resultado,labels=resultado.index,autopct=
|
170 |
-
ax.set_title("Porcentajes por Categorias", fontsize=5, fontweight="bold")
|
171 |
-
plt.rcParams.update({'font.size':
|
172 |
ax.legend()
|
173 |
# Muestra el gráfico
|
174 |
plt.show()
|
|
|
163 |
muestra = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
|
164 |
with col2:
|
165 |
resultado = df['Prediccion'].value_counts()
|
166 |
+
def autopct_fun(abs_values):
|
167 |
+
gen = iter(abs_values)
|
168 |
+
return lambda pct: f"{pct:.1f}% ({next(gen)})"
|
169 |
+
|
170 |
colores=["#EE3555","#aae977"]
|
171 |
fig, ax = plt.subplots()
|
172 |
+
fig.set_size_inches(1.8, 1.8)
|
173 |
+
plt.pie(resultado,labels=resultado.index,autopct=autopct_fun(resultado),colors=colores, textprops={'fontsize': 3})
|
174 |
+
ax.set_title("Porcentajes por Categorias", fontsize=3.5, fontweight="bold")
|
175 |
+
plt.rcParams.update({'font.size':3, 'font.weight':'bold'})
|
176 |
ax.legend()
|
177 |
# Muestra el gráfico
|
178 |
plt.show()
|