ColorMaps in Seaborn HeatMaps
Colormaps are used to visualize heatmaps effectively and easily. One might use different sorts of colormaps for different kinds of heatmaps. In this article, we will look at how to use colormaps while working with seaborn heatmaps.
Sequential Colormaps: We use sequential colormaps when the data values(numeric) goes from high to low and only one of them is important for the analysis.
Example of sequential colormaps:
Note that we have used sns.color_palette() to construct a colormap and sns.palplot() to display the colors present in the colormap. The following example shows how to implement a sequential colormap on a seaborn heatmap.
Since “Greens” is an inbuilt colormap in seaborn, can also directly pass “Greens” to the cmap argument:
Note that our colormap now has a continuous color intensity unlike the one before which had a discrete intensity of green for a range of values. Here is a closer look at both of the colormaps generated in the above-mentioned heatmaps:
Diverging Colormaps: They are used to represent numeric values that go from high to low(and vice-versa), and both high and low values are of interest.
Here are some diverging colormaps present in seaborn:
Example: The following example shows how to implement a diverging colormap on a seaborn heatmap.