Skip to content

Commit

Permalink
sty : simplify the reordering of the correlation matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
celprov committed Mar 24, 2023
1 parent 00ea0e8 commit d273c1e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions mriqc_learn/viz/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,8 @@ def plot_corrmat(
# Keep the indices to sort labels
labels_order = np.argsort(labels)

# Build a new dataframe with the sorted columns
for idx, i in enumerate(data.columns[labels_order]):
if idx == 0:
clustered = pd.DataFrame(data[i])
else:
df_to_append = pd.DataFrame(data[i])
clustered = pd.concat([clustered, df_to_append], axis=1)
data = clustered
# Reorder data
data = data.take(labels_order, axis=0).take(labels_order, axis=1)

if hasattr(data, "columns"):
col_labels = data.columns
Expand Down

0 comments on commit d273c1e

Please sign in to comment.