INNER CODE UNIT · Python
start
stefmolin/Hands-On-Data-Analysis-with-Pandas-2nd-edition · ch_06/color_utils.py:84
start=rgb_color_list[seg - 1][i],
stop=rgb_color_list[seg][i],
num=segment_size + offset
))
rgbas[:,i] = np.concatenate(updates)
return ListedColormap(rgbas)
def draw_cmap(cmap, values=np.array([[0, 1]]), **kwargs):
"""
Draw a colorbar for visualizing a colormap.
Parameters:
- cmap: A matplotlib colormap
- values: The values to use for the colormap, defaults to [0, 1]
- kwargs: Keyword arguments to pass to `plt.colorbar()`