bokeh.models.mappers¶
Models for mapping values from one range or space to another.
-
class
CategoricalColorMapper(**kwargs)¶ Bases:
bokeh.models.mappers.ColorMapperMap categories to colors. Values that are passed to this mapper that aren’t in factors will be assigned the nan_color.
-
factors¶ property type: factors:Either(Seq(String), Seq(Int), Seq(Float), Seq(Datetime), Seq(Date))
A sequence of factors / categories that map to the color palette.
-
-
class
ColorMapper(palette=None, **kwargs)¶ Bases:
bokeh.model.ModelBase class for color mapper types.
ColorMapperis not generally useful to instantiate on its own.-
nan_color¶ property type: nan_color:Color
Color to be used if data is NaN. Default: ‘gray’
-
palette¶ property type: palette:Seq(Color)
A sequence of colors to use as the target palette for mapping.
This property can also be set as a
String, to the name of any of the palettes shown in bokeh.palettes.
-
-
class
ContinuousColorMapper(palette=None, **kwargs)¶ Bases:
bokeh.models.mappers.ColorMapperBase class for cotinuous color mapper types.
ContinuousColorMapperis not generally useful to instantiate on its own.-
high¶ property type: high:Float
The maximum value of the range to map into the palette. Values above this are clamped to
high.
-
high_color¶ property type: high_color:Color
Color to be used if data is lower than
highvalue. If None, values lower thanhighare mapped to the last color in the palette.
-
low¶ property type: low:Float
The minimum value of the range to map into the palette. Values below this are clamped to
low.
-
low_color¶ property type: low_color:Color
Color to be used if data is lower than
lowvalue. If None, values lower thanloware mapped to the first color in the palette.
-
-
class
LinearColorMapper(palette=None, **kwargs)¶ Bases:
bokeh.models.mappers.ContinuousColorMapperMap numbers in a range [low, high] linearly into a sequence of colors (a palette).
For example, if the range is [0, 99] and the palette is
['red', 'green', 'blue'], the values would be mapped as follows:x < 0 : 'red' # values < low are clamped 0 >= x < 33 : 'red' 33 >= x < 66 : 'green' 66 >= x < 99 : 'blue' 99 >= x : 'blue' # values > high are clamped
-
class
LogColorMapper(palette=None, **kwargs)¶ Bases:
bokeh.models.mappers.ContinuousColorMapperMap numbers in a range [low, high] into a sequence of colors (a palette) on a natural logarithm scale.
For example, if the range is [0, 25] and the palette is
['red', 'green', 'blue'], the values would be mapped as follows:x < 0 : 'red' # values < low are clamped 0 >= x < 2.72 : 'red' # math.e ** 1 2.72 >= x < 7.39 : 'green' # math.e ** 2 7.39 >= x < 20.09 : 'blue' # math.e ** 3 20.09 >= x : 'blue' # values > high are clamped
Warning
The LogColorMapper only works for images with scalar values that are non-negative.