How to do it...
The following code block displays three plots; the first one uses the standard colormap, coolwarm, and the other two use user-defined discrete colormaps. Of the two user-defined ones, the first one uses pure RED (1, 0, 0), GREEN (0, 1, 0), and BLUE (0, 0, 1) colors, and the other uses a mix of RGB colors [(1, 0.5, 0), (0.25, 1, 0), (0, 0.5, 1)] to generate three discrete colors. Please note in the first colormap tuple (1, 0, 0), only red is 1; green and blue are zeros. In the second one, the first and second colors are (1, 0.5, 0), and (0.25, 1, 0) means they are a combination of red and green, and the third color is a combination of green and blue.
We are using three discrete colors here, since we have three clusters in the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access