Skip to content

Commit f245076

Browse files
authored
Fix error in Result heatmap color (#1212)
* Resolve issue with heatmap color scaling with negative results + add `%` sign to legend * Remove unused import * Enable diverging color scheme for pos+negative results * Explicitly set cmap
1 parent aebf0d7 commit f245076

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

activity_browser/ui/figures.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ def plot(self, df: pd.DataFrame, invert_plot: bool= False):
134134

135135
# set different color palette depending on whether all values are positive or not
136136
if dfp.min(axis=None) < 0 and dfp.max(axis=None) > 0: # has both negative AND positive values
137-
sns.color_palette("vlag_r", as_cmap=True)
137+
cmap = sns.color_palette("vlag_r", as_cmap=True)
138138
else: # has only positive OR negative values
139-
sns.color_palette("Blues", as_cmap=True)
139+
cmap = sns.color_palette("Blues", as_cmap=True)
140140

141141
sns.heatmap(
142-
prop, ax=self.ax, annot=dfp, linewidths=0.05,
142+
prop, ax=self.ax, cmap=cmap, annot=dfp, linewidths=0.05,
143143
annot_kws={"size": 11 if dfp.shape[1] <= 8 else 9,
144144
"rotation": 0 if dfp.shape[1] <= 8 else 60},
145145
cbar_kws={'format': '%.0f%%'}

0 commit comments

Comments
 (0)