Reputation: 7536
Given the heat map below from here:
flights = sns.load_dataset("flights")
flights = flights.pivot("month", "year", "passengers")
ax = sns.heatmap(flights, annot=True, fmt="d")
for text in ax.texts:
text.set_size(14)
if text.get_text() == '118':
text.set_size(18)
text.set_weight('bold')
text.set_style('italic')
How can I apply similar logic to the y-axis tick labels? For example, what if I wanted to embolden "February", make it 13 point font, and color it red?
Thanks in advance!
Upvotes: 3
Views: 6739
Reputation: 49002
Almost exactly the same idea, you just need to loop over the list of yticklabels
:
flights = sns.load_dataset("flights")
flights = flights.pivot("month", "year", "passengers")
ax = sns.heatmap(flights, annot=True, fmt="d")
for label in ax.get_yticklabels():
if label.get_text() == "February":
label.set_size(13)
label.set_weight("bold")
label.set_color("red")
Upvotes: 7