bokeh.models.mappers

Models for mapping values from one range or space to another.

class ColorMapper(**kwargs)

Bases: bokeh.model.Model

Base class for color mapper types. ColorMapper` is not generally useful to instantiate on its own.

JSON Prototype
{
  "id": "afc8133e-31fa-40e0-a0b0-2a765f875716",
  "name": null,
  "tags": []
}
class LinearColorMapper(palette=None, **kwargs)

Bases: bokeh.models.mappers.ColorMapper

Map 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
high

property type: high:Float

The maximum value of the range to map into the palette. Values above this are clamped to high.

low

property type: low:Float

The minimum value of the range to map into the palette. Values below this are clamped to low.

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.

reserve_color

property type: reserve_color:Color

Used by Abstract Rendering.

reserve_val

property type: reserve_val:Float

Used by Abstract Rendering.

JSON Prototype
{
  "high": null,
  "id": "dce19503-1c7b-4f37-83c3-cc8344f1e7dc",
  "low": null,
  "name": null,
  "palette": null,
  "reserve_color": "#ffffff",
  "reserve_val": null,
  "tags": []
}
class LogColorMapper(palette=None, **kwargs)

Bases: bokeh.models.mappers.ColorMapper

Map 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.

high

property type: high:Float

The maximum value of the range to map into the palette. Values above this are clamped to high.

low

property type: low:Float

The minimum value of the range to map into the palette. Values below this are clamped to low.

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.

JSON Prototype
{
  "high": null,
  "id": "00e7e1b5-ece3-4249-a2c3-024720c56bc0",
  "low": null,
  "name": null,
  "palette": null,
  "tags": []
}