I have two heatmap subplots using Seaborn (shown below) I have looked for tutorials/help etc everywhere but I cannot figure out:
Q) How to change the color of the colorbar numbers on each of the heatmaps?
I want them both to be the color "yellow" and not the default "black"
Thank you for you time.
line_df
total_df
fig.set_facecolor("Blue")
fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12,6))
sns.heatmap(line_df, ax = ax1, annot=True, annot_kws={'fontsize': 16, 'fontweight':'bold'}, xticklabels=line_df.columns, yticklabels=line_df.index, cbar_kws={'orientation':'vertical'} )
ax1.yaxis.label.set_color("Blue")
ax1.tick_params(colors="yellow")
sns.heatmap(total_df, ax = ax2, annot=True, annot_kws={'fontsize': 16, 'fontweight':'bold',}, xticklabels=total_df.columns, yticklabels=False, cbar_kws={'orientation':'vertical'})
ax2.get_yaxis().set_visible(False)
ax2.tick_params(colors="yellow")
fig.tight_layout()
plt.show()
plt.close()
CodePudding user response:
You will need to use this to change the parameters including font color by calling each of the axis colorbar and then change the tick_params for that axis. As there was no data available, I have used random arrays to demonstrate the same. You can find more information tick_params