Skip to content

Commit

Permalink
fix: TypeError launched by ax.spines[:]
Browse files Browse the repository at this point in the history
  • Loading branch information
celprov committed Oct 25, 2023
1 parent 3f10199 commit 81867f0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mriqc_learn/viz/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ def plot_corrmat(
if sorted:
from scipy.cluster.hierarchy import linkage, dendrogram, fcluster

Z = linkage(data, 'complete', optimal_ordering=True)
Z = linkage(data, "complete", optimal_ordering=True)

dendrogram(Z, labels=data.columns, no_plot=True)

# Clusterize the data
threshold = 0.1
labels = fcluster(Z, threshold, criterion='distance')
labels = fcluster(Z, threshold, criterion="distance")
# Keep the indices to sort labels
labels_order = np.argsort(labels)

Expand Down Expand Up @@ -273,10 +273,16 @@ def plot_corrmat(
ax.tick_params(top=False, bottom=True, labeltop=False, labelbottom=True)

# Rotate the tick labels and set their alignment.
plt.setp(ax.get_xticklabels(), rotation=90, ha="right", va="center", rotation_mode="anchor")
plt.setp(
ax.get_xticklabels(),
rotation=90,
ha="right",
va="center",
rotation_mode="anchor",
)

# Turn spines off and create white grid.
ax.spines[:].set_visible(False)
plt.setp(ax.spines.values(), visible=False)

ax.set_xticks(np.arange(data.shape[1] + 1) - 0.5, minor=True)
ax.set_yticks(np.arange(data.shape[0] + 1) - 0.5, minor=True)
Expand Down

0 comments on commit 81867f0

Please sign in to comment.