my_code_base.plot.colors¶
Functions¶
Create and return a color map that can be used in heat map figures. |
|
|
Convert hex to rgb colors |
|
Convert rgb to decimal colours (i.e. divides each value by 255) |
Module Contents¶
-
my_code_base.plot.colors.build_continuous_cmap(hex_list: list[str], float_list=
None, N=256, name='my_cmap') matplotlib.colors.LinearSegmentedColormap[source]¶ Create and return a color map that can be used in heat map figures. If float_list is not provided, colour map graduates linearly between each color in hex_list. If float_list is provided, each color in hex_list is mapped to the respective location in float_list.
Source: https://towardsdatascience.com/beautiful-custom-colormaps-with-matplotlib-5bab3d1f0e72
- my_code_base.plot.colors.hex_to_rgb(value: str) tuple[source]¶
Convert hex to rgb colors
- Parameters:¶
- value : string¶
String of 6 characters representing a hex colour.
- Returns:¶
list length 3 of RGB values
- Return type:¶
Examples
>>> hex_to_rgb('#f00') # red (255, 0, 0) >>> hex_to_rgb('fff') # white (255, 255, 255)