Seaborn: clustermap: access the reordered row/column indices

Created on 23 Jun 2017  路  2Comments  路  Source: mwaskom/seaborn

First thanks for the nice visualization library. Clustermaps look really great. I was trying to access the reordered row and column indices, but clustergrid.dendrogram_row.reordered_ind and clustergrid.dendrogram_col.reordered_ind are not working. I tried both sns.clustergrid.dendrogram_row.reordered_ind and clustergrid.dendrogram_row.reordered_ind, leading to error messages: "AttributeError: module 'seaborn' has no attribute 'clustergrid'" and "NameError: name 'clustergrid' is not defined", respectively. How should this function be used properly? An example on http://seaborn.pydata.org/generated/seaborn.clustermap.html would be helpful. Thanks again!

Most helpful comment

For anyone landing on this page looking for an answer to the question:

To access the reordered row indices, use: clustergrid.dendrogram_row.reordered_ind
Column indices, use: clustergrid.dendrogram_col.reordered_ind

All 2 comments

clustergrid is the object returned by the clustermap function. It has useful attributes, including the ones you are looking for.

For anyone landing on this page looking for an answer to the question:

To access the reordered row indices, use: clustergrid.dendrogram_row.reordered_ind
Column indices, use: clustergrid.dendrogram_col.reordered_ind

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tritemio picture tritemio  路  3Comments

stonebig picture stonebig  路  4Comments

sofiatti picture sofiatti  路  4Comments

amelio-vazquez-reina picture amelio-vazquez-reina  路  3Comments

phantom0301 picture phantom0301  路  3Comments