matplotlib - Hierarchical clustering of heatmap in python -
I have an NXM matrix with values from 0 to 20. I easily get a heatmap using matplotib and packer. Now I want to apply a hierarchical clustering and a dangram which uses SASP. I want to re-order each dimension (rows and columns) so that it can show which elements are the same (according to the clustering result). If the matrix class (NxN), then the code would be something like this:
clustering = linking (matrix, method = "average") dendrod (clustering, orientation = 'right')
How do I get link matrix when the dimensions are different? Do I have to calculate each distance manually between each pair element?
I'm not sure how this is using matlotib and pancalir, though the marine carbon package There is basic support for what you are trying to achieve. Example:
Import seaweed as SAB; Sns.set () Flights = sns.load_dataset ("Flights") Flights = Flights. ("Month", "year", "passengers") g = sns.clustermap (flights)
Comments
Post a Comment