0

I am trying to learn this code here

When running this:

corr_matrix = df[selected_features].corr()
correlations_array = np.asarray(corr_matrix)

linkage = hierarchy.linkage(distance.pdist(correlations_array), method='average')

g = sns.clustermap(corr_matrix,row_linkage=linkage,col_linkage=linkage,\
                   row_cluster=True,col_cluster=True,figsize=(6,6),cmap='Greens')
plt.setp(g.ax_heatmap.yaxis.get_majorticklabels(), rotation=0)
plt.show()

label_order = corr_matrix.iloc[:,g.dendrogram_row.reordered_ind].columns

I am getting the following error:

AttributeError: Unknown property axisbg

which is related to:

self._axes_class.init(self, fig, self.figbox, **kwargs)

I tried to read here and there to solve this and failed. I appreciate your help!

Giladbi
  • 1,822
  • 3
  • 19
  • 34

1 Answers1

2

It seems axisbg was deprecated in a previous version of matplotlib. The reason you are seeing this error is because Colaboratory is using an older version of seaborn (0.7.1).

To solve this issue add this !pip install --upgrade seaborn==0.9.0 before the imports. Make sure you restart your runtime after.

hygorxaraujo
  • 659
  • 6
  • 19