Repository navigation
3.1 Visualization Tools
Perfecto para diagramas y algunos gráficos simples.
- Pastel (útil para composiciones pequeñas):
pie showData
title Distribución de categorías
"Clase A" : 34
"Clase B" : 21
"Clase C" : 45
- Timeline / Gantt (pseudo-series temporales):
gantt
dateFormat YYYY-MM-DD
title Evolución del proyecto
section Ingesta de datos
Parser CSV :done, a1, 2025-09-01, 2025-09-05
Validador :active, a2, 2025-09-06, 2025-09-12
section Visualización
Prototipo dashboard : a3, 2025-09-10, 2025-09-20
Nota: Mermaid es ideal para diagramas (flowchart, class, state, ER, mindmap, journey, timeline, gantt, pie). Para gráficas de datos continuos (series, scatter, histogramas), mejor generar imágenes (opción 3) o usar GitHub Pages + Vega-Lite (opción 4).
Para fórmulas, unidades, anotaciones en tus notas/gráficos.
- Inline:
$\sigma^2 = \frac{1}{n}\sum (x_i - \mu)^2$ - Bloque:
$$
z = \frac{x - \mu}{\sigma}
$$La vía robusta: generas las gráficas con Python/R y las insertas en la wiki.
- Clona la Wiki (es un repo aparte):
git clone https://github.com/<usuario>/<repo>.wiki.git
cd <repo>.wiki
mkdir -p img- Genera gráficos a
img/(mejor SVG para nitidez). - Referéncialos en tus páginas wiki:
git add . && git commit -m "Añadir gráficas" && git push
Guarda esto en el repo de la wiki (p. ej.,
scripts/graficas.py) o ejecútalo local y copia los SVG aimg/.
# scripts/graficas.py
# Intención: generar gráficos reproducibles en SVG para la wiki.
def GenerarGraficas():
import os
import pathlib
import matplotlib.pyplot as plt
outdir = pathlib.Path("img")
outdir.mkdir(parents=True, exist_ok=True)
# Ejemplo 1: series temporales simples
meses = ["E", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]
ventas = [12, 14, 18, 17, 20, 21, 25, 24, 23, 27, 28, 30]
plt.figure()
plt.plot(meses, ventas, marker="o")
plt.title("Ventas por mes")
plt.xlabel("Mes")
plt.ylabel("Unidades")
plt.tight_layout()
plt.savefig(outdir / "ventas_por_mes.svg")
plt.close()
# Ejemplo 2: barras categóricas
categorias = ["A", "B", "C", "D"]
valores = [34, 21, 45, 12]
plt.figure()
plt.bar(categorias, valores)
plt.title("Distribución por categoría")
plt.xlabel("Categoría")
plt.ylabel("Valor")
plt.tight_layout()
plt.savefig(outdir / "dist_categoria.svg")
plt.close()
if __name__ == "__main__":
GenerarGraficas()Repite el patrón para histogramas, scatter, boxplots, etc. SVG queda perfecto en GitHub y es liviano.
Tip DRY: guarda tus datos en /data/*.csv y escribe un Makefile o scripts/build.py que regenere todo en un paso.
Las wikis sanitizan HTML/JS, así que lo interactivo real va mejor en Pages. Crea /docs/chart.html en el repo principal y en Settings → Pages activa la rama que sirva /docs/.
Guarda como docs/chart.html en el repo principal:
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Demo Vega-Lite</title>
<script src="https://cdn.jsdelivr.net/npm/vega@5"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@5"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@6"></script>
</head>
<body>
<div id="vis"></div>
<script>
const spec = {
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Ventas por mes",
"data": {
"values": [
{"mes":"E","ventas":12},{"mes":"F","ventas":14},
{"mes":"M","ventas":18},{"mes":"A","ventas":17},
{"mes":"M","ventas":20},{"mes":"J","ventas":21},
{"mes":"J","ventas":25},{"mes":"A","ventas":24},
{"mes":"S","ventas":23},{"mes":"O","ventas":27},
{"mes":"N","ventas":28},{"mes":"D","ventas":30}
]
},
"mark": "line",
"encoding": {
"x": {"field": "mes", "type": "ordinal", "title": "Mes"},
"y": {"field": "ventas", "type": "quantitative", "title": "Unidades"},
"tooltip": [{"field":"mes"},{"field":"ventas"}]
}
};
vegaEmbed('#vis', spec, {actions: false});
</script>
</body>
</html>Luego, desde la wiki, enlaza:
👉 [Ver gráfico interactivo (Vega-Lite)](https://<usuario>.github.io/<repo>/chart.html)Si usas notebooks (.ipynb) con Matplotlib/Plotly:
- Sube el
.ipynbal repo. - GitHub lo renderiza estáticamente (las imágenes ya generadas se ven).
- En la wiki, enlaza el notebook:
[Exploración de ventas (Notebook)](../blob/main/notebooks/exploracion_ventas.ipynb)Si quieres regenerar imágenes estáticas automáticamente:
- Pon tus scripts en el repo de la wiki o en el principal (si alojas imágenes allí).
- Crea un workflow mínimo
.github/workflows/build-plots.yml(en el repo que guarda las imágenes):
name: build-plots
on:
push:
paths:
- 'data/**'
- 'scripts/**'
- '.github/workflows/build-plots.yml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python -m pip install --upgrade pip matplotlib
- run: python scripts/graficas.py
- name: Commit updated images
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add img/*.svg || true
git commit -m "Update plots" || echo "No changes"
git pushPara actuar sobre el repo de la wiki, lo más limpio es mantener las imágenes en el repo principal (carpeta
/docs/imgo/assets/img) y usarlas desde la wiki con rutas absolutas al GitHub Pages (cuando tengas Pages activo), o clonar manualmente la wiki para subir imágenes.
- Notas/diagramas rápidos → Mermaid + MathJax en la wiki (nativo).
- Gráficos de datos estáticos → genera SVG con Python y embébelo en la wiki.
- Interactividad real → GitHub Pages + Vega-Lite y enlaza desde la wiki.
-
Prototipo de análisis → Notebook
.ipynbcon imágenes incluidas y enlace desde wiki.
Si quieres, te preparo una plantilla mínima de repo + wiki:
-
/data/(CSV de ejemplo) -
/scripts/graficas.py(genera SVG) -
/docs/chart.html(Vega-Lite) - Wiki con
Home.mdenlazando aimg/*.svg, achart.html, y con secciones Mermaid/MathJax.
Legend:
- 🔰 Start here
- 🏵️ Important Insight
- ⚙️ Technical and applications
- 💻 Some Code
- ⚜️ Advanced Topics
- 00.1 What Is Data?
-
00.2 Three Models of Reality (planned)
- 00.2.1 The Linguistic
- 00.2.2 The Symbolic
- 00.3.3 The Mathematical
- 00.3 Maps and Reality
- 00.4 Aside: Hossack, data as structure
- 00.5 Aside: Chomsky, data as evidence
- 01.1 🔰 Sets and Logic (planned)
- 01.2 Sample Space
- 01.3 Randomness and Pattern
- 01.4 Outcomes and Events
- 01.5 Finite and Infinite Sample Spaces
- 02.1 🔰 Functions (planned)
- 02.2 Types Are Alphabets
- 02.3 Random Variables: X : Ω → 𝒳 (planned)
- 02.4 Measurement Scales
- 02.5 Numerics
- 03.1 🔰 Fractions and Proportions (planned)
- 03.2 Randomness vs Uncertainty
- 03.3 Probability: Events, Conditioning, Bayes
- 03.4 Bayes' Theorem, Step by Step
- 03.5 Expected Value and Variance (planned)
- 03.6 Bernoulli (ES)
- 03.7 Discrete Uniform (ES)
- 03.8 🧗 Kolmogorov: Ω, 𝒜, ℙ
- 04.1 🔰 Powers and Logarithms (planned)
- 04.2 Rarity
- 04.3 Information Theory (Shannon)
- 04.4 Entropy: Three Views
- 05.1 🔰 Sums and Averages (planned)
- 05.2 Data, Measured
- 05.3 Sampling (ES)
- 05.4 Population and Sample (ES)
- 05.5 Types of Sampling (ES)
- 05.6 Choosing Summaries & Visuals
- 05.7 Visualization
- 05.8 Plots
- 06.1 What Is Statistics?
- 06.2 🔰 Curves and Area (planned)
- 06.3 Statistical Thinking
- 06.4 Variation
- 06.5 Uncertainty
- 06.6 Parameters vs Estimators (ES)
- 06.7 Distributions
- 06.8 Statistical Modeling
- 06.9 Statistical Methods
- 07.1 Data Storage: Databases (stub)
- 07.2 ER Diagrams
- 07.3 Chen Diagrams
- 07.4 SQL (planned)
- 07.5 Formal Languages and Regular Expressions (planned)
- 07.6 Reproducibility (planned)
08 · μ(x) — Fuzzy - When data is flexible
- 08.1 Fuzzy Logic (planned)
- 08.2 Fuzzy Numbers (planned)
- 08.3 Possibility vs Probability (planned)
09 · x(t) — Signals and systems - Where patterns live
- 09.1 Signals (stub)
- 09.2 Sampling and Aliasing (planned)
- 09.3 Convolution (planned)
- 09.4 Frequency (planned)
- 10.1 🔰 Vectors and Matrices (planned)
- 10.2 Mathematical Modelling (planned)
- 11.1 🔰 Derivatives (planned)
- 11.2 Convex Optimisation (planned)
- 12.1 Supervised Learning (planned)
- 12.2 Data in Language Models
- 13.1 Cause and Effect (planned)
- 13.2 Capstone Guide (planned)