Skip to content

Commit

Permalink
fix(corr_interactive_plot): add MultiIndex support
Browse files Browse the repository at this point in the history
  • Loading branch information
m-marqx committed Dec 21, 2023
1 parent 6328744 commit 90703c8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/klib/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,15 @@ def corr_interactive_plot(

vtext = corr.round(2).fillna("") if annot else None

corr_columns = corr.columns
corr_index = corr.index

if isinstance(corr_columns, pd.MultiIndex):
corr_columns = ["-".join(col) for col in corr.columns]

if isinstance(corr_index, pd.MultiIndex):
corr_index = ["-".join(idx) for idx in corr.index]

# Specify kwargs for the heatmap
kwargs = {
"colorscale": cmap,
Expand All @@ -599,8 +608,8 @@ def corr_interactive_plot(
"text": vtext,
"texttemplate": "%{text}",
"textfont": {"size": 12},
"x": corr.columns,
"y": corr.index,
"x": corr_columns,
"y": corr_index,
"z": corr,
**kwargs,
}
Expand Down

0 comments on commit 90703c8

Please sign in to comment.