How to make one column of bold annotations on a heatmap

164 Views Asked by At

How to format (make bold) the annotations in one particular column in a Python Seaborn heatmap? (https://seaborn.pydata.org/generated/seaborn.heatmap.html)

1

There are 1 best solutions below

0
BigBen On BEST ANSWER

Using Axes.texts and Text.set_fontweight:

import numpy as np
import seaborn as sns

glue = sns.load_dataset("glue").pivot(columns="Model", index="Task", values="Score")
ax = sns.heatmap(glue, annot=True)

col = 0
for idx in np.arange(glue.size).reshape(glue.shape)[:, col]:
    ax.texts[idx].set_fontweight('bold')

Output:

enter image description here