INNER CODE UNIT · Python
blended_cmap
stefmolin/Hands-On-Data-Analysis-with-Pandas-2nd-edition · ch_06/color_utils.py:44
def blended_cmap(rgb_color_list):
"""
Created a colormap blending from one color to the other.
Parameters:
- rgb_color_list: A list of colors represented as [R, G, B]
values in the range [0, 1], like [[0, 0, 0], [1, 1, 1]],
for black and white, respectively.
Returns:
A matplotlib `ListedColormap` object
"""
if not isinstance(rgb_color_list, list):
raise ValueError('Colors must be passed as a list.')
elif len(rgb_color_list) < 2:
raise ValueError('Must specify at least 2 colors.')
elif (
not isinstance(rgb_color_list[0], list)