Update modules/ui.py
Browse files- modules/ui.py +26 -12
modules/ui.py
CHANGED
|
@@ -88,24 +88,38 @@ def display_student_progress(username):
|
|
| 88 |
# Gráfico de barras para el conteo de palabras por categoría
|
| 89 |
if student_data['word_count']:
|
| 90 |
st.subheader("Conteo Total de Palabras por Categoría Gramatical")
|
| 91 |
-
fig =
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
# Mostrar evolución del conteo de palabras
|
| 97 |
st.subheader("Evolución del Conteo de Palabras")
|
| 98 |
-
evolution_data =
|
| 99 |
for i, entry in enumerate(student_data['entries']):
|
| 100 |
for category, count in entry.get('word_count', {}).items():
|
| 101 |
-
evolution_data
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
})
|
| 106 |
if evolution_data:
|
| 107 |
-
fig =
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
# Mostrar entradas recientes
|
| 111 |
st.header("Entradas Recientes")
|
|
|
|
| 88 |
# Gráfico de barras para el conteo de palabras por categoría
|
| 89 |
if student_data['word_count']:
|
| 90 |
st.subheader("Conteo Total de Palabras por Categoría Gramatical")
|
| 91 |
+
fig, ax = plt.subplots(figsize=(10, 6))
|
| 92 |
+
categories = list(student_data['word_count'].keys())
|
| 93 |
+
counts = list(student_data['word_count'].values())
|
| 94 |
+
ax.bar(categories, counts)
|
| 95 |
+
ax.set_xlabel('Categoría')
|
| 96 |
+
ax.set_ylabel('Conteo Total')
|
| 97 |
+
ax.set_title('Conteo de Palabras por Categoría Gramatical')
|
| 98 |
+
plt.xticks(rotation=45, ha='right')
|
| 99 |
+
st.pyplot(fig)
|
| 100 |
+
else:
|
| 101 |
+
st.info("No hay datos de conteo de palabras disponibles.")
|
| 102 |
|
| 103 |
# Mostrar evolución del conteo de palabras
|
| 104 |
st.subheader("Evolución del Conteo de Palabras")
|
| 105 |
+
evolution_data = {}
|
| 106 |
for i, entry in enumerate(student_data['entries']):
|
| 107 |
for category, count in entry.get('word_count', {}).items():
|
| 108 |
+
if category not in evolution_data:
|
| 109 |
+
evolution_data[category] = []
|
| 110 |
+
evolution_data[category].append(count)
|
| 111 |
+
|
|
|
|
| 112 |
if evolution_data:
|
| 113 |
+
fig, ax = plt.subplots(figsize=(10, 6))
|
| 114 |
+
for category, counts in evolution_data.items():
|
| 115 |
+
ax.plot(range(1, len(counts) + 1), counts, label=category)
|
| 116 |
+
ax.set_xlabel('Número de Entrada')
|
| 117 |
+
ax.set_ylabel('Conteo de Palabras')
|
| 118 |
+
ax.set_title('Evolución del Conteo de Palabras por Categoría')
|
| 119 |
+
ax.legend()
|
| 120 |
+
st.pyplot(fig)
|
| 121 |
+
else:
|
| 122 |
+
st.info("No hay suficientes datos para mostrar la evolución del conteo de palabras.")
|
| 123 |
|
| 124 |
# Mostrar entradas recientes
|
| 125 |
st.header("Entradas Recientes")
|