In the previous recipe, we learned how to leverage pre-defined colors and colormaps and how to customize them for specific needs. In this recipe, we will learn how to create our own colormaps. We will use the Iris dataset for this example.
User-defined colors and colormaps
Getting ready
We will first learn how to create discrete colormaps, followed by continuous colormaps.
Import the following required libraries:
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
How to do it...
The following code...