Files
fn_registry/python/functions/datascience/plot_kde_2d.md
T
egutierrez 47fac22230 chore: auto-commit (799 archivos)
- .claude/CLAUDE.md
- .claude/commands/subagentes.md
- .claude/rules/INDEX.md
- .mcp.json
- bash/functions/cybersecurity/analyze_dns.md
- bash/functions/cybersecurity/audit_http_headers.md
- bash/functions/cybersecurity/audit_ssh_config.md
- bash/functions/cybersecurity/check_firewall.md
- bash/functions/cybersecurity/detect_suspicious_users.md
- bash/functions/cybersecurity/encrypt_file.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 00:28:20 +02:00

2.5 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path, source_repo, source_license, source_file
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path source_repo source_license source_file
plot_kde_2d function py datascience 1.0.0 impure def plot_kde_2d(ax: Axes, xs: list[float] | np.ndarray, ys: list[float] | np.ndarray, cmap: str = 'magma', alpha: float = 0.35, thresh: float = 0.02, levels: int = 30, bw_adjust: float = 0.6) -> None Dibuja un KDE 2D como contornos rellenos sobre un Axes de matplotlib usando seaborn.kdeplot. Si los arrays están vacíos retorna sin pintar.
visualization
kde
density
seaborn
matplotlib
datascience
pendiente-usar
false error_go_core
numpy
seaborn
matplotlib
name desc
ax matplotlib Axes sobre el que se dibuja la densidad.
name desc
xs Coordenadas X de los puntos (longitud o x proyectada).
name desc
ys Coordenadas Y de los puntos (latitud o y proyectada).
name desc
cmap Nombre del colormap de matplotlib para el relleno de densidad. Default 'magma'.
name desc
alpha Opacidad del overlay de densidad (0-1). Default 0.35.
name desc
thresh Umbral de densidad por debajo del cual no se dibujan contornos (0-1). Default 0.02.
name desc
levels Número de niveles de contorno. Default 30.
name desc
bw_adjust Factor de ajuste del ancho de banda del kernel. Valores < 1 producen estimaciones más detalladas. Default 0.6.
None. Modifica el Axes in-place añadiendo los contornos de densidad. true
50 puntos aleatorios no lanza excepción
arrays vacíos retorna sin error
python/functions/datascience/tests/test_plot_kde_2d.py python/functions/datascience/plot_kde_2d.py internal:footprint_aurgi internal-aurgi ponderacion_isochronas/src/recomendador_centros.py:275

Ejemplo

import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
from datascience.plot_kde_2d import plot_kde_2d

rng = np.random.default_rng(42)
xs = rng.normal(0, 1, 200)
ys = rng.normal(0, 1, 200)

fig, ax = plt.subplots()
plot_kde_2d(ax, xs, ys, cmap="viridis", alpha=0.5)
fig.savefig("kde.png")

Notas

Requiere seaborn y numpy. El parámetro fill=True se pasa a seaborn.kdeplot para renderizar contornos rellenos (disponible desde seaborn 0.11). Arrays vacíos se detectan con np.asarray(xs).size == 0 antes de llamar a seaborn para evitar errores internos.