trappy.plotter.ColorMap module

Defines a generic indexable ColorMap Class

class trappy.plotter.ColorMap.ColorMap(num_colors, cmap='hsv')[source]

Bases: object

The Color Map Class to return a gradient method

Parameters:num_colors (int) – Number or colors for which a gradient is needed
cmap(index)[source]
Parameters:index (int) – Index for the gradient array
Returns:The color at specified index
cmap_inv(index)[source]
Parameters:index (int) – Index for the gradient array
Returns:The color at \(N_{colors} - i\)
classmethod rgb_cmap(rgb_list)[source]

Constructor for a ColorMap from an rgb_list

Parameters:rgb_list (list of tuples) – A list of rgb tuples for red, green and blue. The rgb values should be in the range 0-255.
trappy.plotter.ColorMap.to_dygraph_colors(color_map)[source]

Convert a color_map specified as a list of rgb tuples to the syntax that dygraphs expect: [“rgb(1, 2, 3)”, “rgb(4, 5, 6)”,...]

Parameters:color_map (list of tuples) – a list of rgb tuples