How to invert color of seaborn heatmap colorbar

前端 未结 4 1299
闹比i
闹比i 2021-01-30 23:10

I use an heatmap to visualize a confusion matrix. I like the standard colors, but I would like to have 0s in light orange and highest values in dark purple.

I managed to

4条回答
  •  天涯浪人
    2021-01-30 23:22

    we can now quickly achieve reverse color just by putting _r in the end.

    For example: for viridis => viridis_r

    sns.heatmap(corr_matrix, annot=True, cmap='viridis_r');
    

提交回复
热议问题