Models for mapping values from one range or space to another in the client.
Mappers (as opposed to scales) are not presumed to be invertible.
Mapper
Bases: bokeh.models.transforms.Transform
bokeh.models.transforms.Transform
Base class for mappers.
Note
This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.
{ "id": "12670", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
ColorMapper
Bases: bokeh.models.mappers.Mapper
bokeh.models.mappers.Mapper
Base class for color mapper types.
nan_color
property type: Color
Color
Color to be used if data is NaN or otherwise not mappable. (Default: ‘gray’)
palette
property type: Seq ( Color )
Seq
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.
String
{ "id": "12671", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "nan_color": "gray", "palette": null, "subscribed_events": [], "tags": [] }
CategoricalMapper
Base class for mappers that map categorical factors to other values.
end
property type: Int
Int
A start index to “slice” data factors with before mapping.
For example, if the data to color map consists of 2-level factors such as ["2016", "sales"] and ["2017", "marketing"], then setting end=1 will perform color mapping only based on the first sub-factor (i.e. in this case based on the year "2016" or "2017")
["2016", "sales"]
["2017", "marketing"]
end=1
"2016"
"2017"
If None then all sub-factors from start to the end of the factor will be used for color mapping.
None
start
factors
property type: Either ( Seq ( String ), Seq ( Tuple ( String , String ) ), Seq ( Tuple ( String , String , String ) ) )
Either
Tuple
A sequence of factors / categories that map to the some target range. For example the following color mapper:
mapper = CategoricalColorMapper(palette=["red", "blue"], factors=["foo", "bar"])
will map the factor "foo" to red and the factor "bar" to blue.
"foo"
"bar"
For example, if the data to color map consists of 2-level factors such as ["2016", "sales"] and ["2016", "marketing"], then setting start=1 will perform color mapping only based on the second sub-factor (i.e. in this case based on the department "sales" or "marketing")
["2016", "marketing"]
start=1
"sales"
"marketing"
{ "end": null, "factors": null, "id": "12674", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "start": 0, "subscribed_events": [], "tags": [] }
CategoricalColorMapper
Bases: bokeh.models.mappers.CategoricalMapper, bokeh.models.mappers.ColorMapper
bokeh.models.mappers.CategoricalMapper
bokeh.models.mappers.ColorMapper
Map categorical factors to colors.
Values that are passed to this mapper that are not in the factors list will be mapped to nan_color.
{ "end": null, "factors": null, "id": "12678", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "nan_color": "gray", "palette": null, "start": 0, "subscribed_events": [], "tags": [] }
CategoricalMarkerMapper
Bases: bokeh.models.mappers.CategoricalMapper
Map categorical factors to marker types.
Values that are passed to this mapper that are not in the factors list will be mapped to default_value.
default_value
This mappers is primarily only useful with the Scatter marker glyph that be parameterized by marker type.
Scatter
property type: MarkerType ( MarkerType )
MarkerType
A marker type to use in case an unrecognized factor is passed in to be mapped.
markers
property type: Seq ( MarkerType ( MarkerType ) )
A sequence of marker types to use as the target for mapping.
{ "default_value": "circle", "end": null, "factors": null, "id": "12679", "js_event_callbacks": {}, "js_property_callbacks": {}, "markers": null, "name": null, "start": 0, "subscribed_events": [], "tags": [] }
CategoricalPatternMapper
Map categorical factors to hatch fill patterns.
Added in version 1.1.1
property type: HatchPatternType
HatchPatternType
A hatch pattern to use in case an unrecognized factor is passed in to be mapped.
patterns
property type: Seq ( HatchPatternType )
{ "default_value": " ", "end": null, "factors": null, "id": "12682", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "patterns": null, "start": 0, "subscribed_events": [], "tags": [] }
ContinuousColorMapper
Bases: bokeh.models.mappers.ColorMapper
Base class for continuous color mapper types.
high
property type: Float
Float
The maximum value of the range to map into the palette. Values above this are clamped to high.
high_color
Color to be used if data is higher than high value. If None, values higher than high are mapped to the last color in the palette.
low
The minimum value of the range to map into the palette. Values below this are clamped to low.
low_color
Color to be used if data is lower than low value. If None, values lower than low are mapped to the first color in the palette.
{ "high": null, "high_color": null, "id": "12685", "js_event_callbacks": {}, "js_property_callbacks": {}, "low": null, "low_color": null, "name": null, "nan_color": "gray", "palette": null, "subscribed_events": [], "tags": [] }
LinearColorMapper
Bases: bokeh.models.mappers.ContinuousColorMapper
bokeh.models.mappers.ContinuousColorMapper
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:
['red', 'green', 'blue']
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": null, "high_color": null, "id": "12690", "js_event_callbacks": {}, "js_property_callbacks": {}, "low": null, "low_color": null, "name": null, "nan_color": "gray", "palette": null, "subscribed_events": [], "tags": [] }
LogColorMapper
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": null, "high_color": null, "id": "12691", "js_event_callbacks": {}, "js_property_callbacks": {}, "low": null, "low_color": null, "name": null, "nan_color": "gray", "palette": null, "subscribed_events": [], "tags": [] }