“Cómo dibujar dendrograma en Python” Código de respuesta

Cómo dibujar dendrograma en Python

>>> from scipy.cluster import hierarchy
>>> import matplotlib.pyplot as plt
Cooperative Crane

Cómo dibujar dendrograma en Python

>>> ytdist = np.array([662., 877., 255., 412., 996., 295., 468., 268.,
...                    400., 754., 564., 138., 219., 869., 669.])
>>> Z = hierarchy.linkage(ytdist, 'single')
>>> plt.figure()
>>> dn = hierarchy.dendrogram(Z)
Disturbed Donkey

Cómo dibujar dendrograma en Python

>>> hierarchy.set_link_color_palette(['m', 'c', 'y', 'k'])
>>> fig, axes = plt.subplots(1, 2, figsize=(8, 3))
>>> dn1 = hierarchy.dendrogram(Z, ax=axes[0], above_threshold_color='y',
...                            orientation='top')
>>> dn2 = hierarchy.dendrogram(Z, ax=axes[1],
...                            above_threshold_color='#bcbddc',
...                            orientation='right')
>>> hierarchy.set_link_color_palette(None)  # reset to default after use
>>> plt.show()
Cooperative Crane

Respuestas similares a “Cómo dibujar dendrograma en Python”

Preguntas similares a “Cómo dibujar dendrograma en Python”

Más respuestas relacionadas con “Cómo dibujar dendrograma en Python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código