ColorMap¶
-
class
visualife.core.styles.ColorMap(stops, **kwargs)¶ Bases:
objectA class that converts a real value into a color
The constructor creates a color map from given stops
Parameters: - stops (
listof(float, color)tuples,colorisstrin HEX format or color name) – values and colors that defines stops in ColorMap object - kwargs – see below
Keyword Arguments (**kwargs) (**kwargs):- left_color (
color) – a color assigned to values lover than the first stop color; by default the leftmost color is used - right_color (
color) – a color assigned to values higher than the last stop color; by default the rightmost color is used - continuous_palette (
bool) – if True creates a continuous color palette
Attributes Summary
left_colorReturns a color assigned to values lover than the first stop color max_valueReturns the maximum value of this color scale. min_valueReturns the minimum value of this color scale. right_colorReturns a color assigned to values lover than the last stop color Methods Summary
color(val)Returns an RGB color (as a string) for given value color_tuple(val)Returns an RGB color (as a tuple of 3 integer components) for given value continuous_color(val)Returns a color for given value continuous_palette(pal, str]], <class >}[, s])Retrun continuous color scale Attributes Documentation
-
left_color¶ Returns a color assigned to values lover than the first stop color
-
max_value¶ Returns the maximum value of this color scale. All values higher than this one will be painted with self.right_color color
Returns: maximum value of this color scale
-
min_value¶ Returns the minimum value of this color scale. All values lower than this one will be painted with self.left_color color
Returns: minimum value of this color scale
-
right_color¶ Returns a color assigned to values lover than the last stop color
Methods Documentation
-
color(val) → str¶ Returns an RGB color (as a string) for given value
Parameters: val ( float) – value for a color
-
color_tuple(val) → tuple¶ Returns an RGB color (as a tuple of 3 integer components) for given value
Parameters: val ( tuple) – value for a color
-
continuous_color(val: float) → str¶ Returns a color for given value
Parameters: val ( float) – value for a colorReturns: string in HEX format
-
static
continuous_palette(pal: {typing.List[typing.Tuple[float, str]], <class 'object'>}, s=0.1) → Tuple[List[float], List[str]]¶ Retrun continuous color scale
Parameters: - pal (
ColorMapobject orlistof(float, color)tuples,colorisstrin HEX format or color name) – discreet color palette - s (``float) – resolution
Returns: tupleof twolist, first holds values, second holds colors in HEX format- pal (
- stops (