bokeh.transform#
Helper functions for applying client-side computations such as
transformations to data fields or ColumnDataSource expressions.
- cumsum(field_name: str, include_zero: bool = False) Expr[source]#
- Create a - DataSpecdict to generate a- CumSumexpression for a- ColumnDataSource.- Parameters:
 - Examples - p.wedge(start_angle=cumsum('angle', include_zero=True), end_angle=cumsum('angle'), ...) - will generate a - CumSumexpressions that sum the- "angle"column of a data source. For the- start_anglevalue, the cumulative sums will start with a zero value. For- end_angle, no initial zero will be added (i.e. the sums will start with the first angle value, and include the last).
- dodge(field_name: str, value: float, range: Range | None = None) Field[source]#
- Create a - DataSpecdict that applies a client-side- Dodgetransformation to a- ColumnDataSourcecolumn.- Parameters:
- Returns:
- Field 
 
- eqhist_cmap(field_name: str, palette: Sequence[ColorLike], low: float, high: float, low_color: ColorLike | None = None, high_color: ColorLike | None = None, nan_color: ColorLike = 'gray') Field[source]#
- Create a - DataSpecdict that applies a client-side- EqHistColorMappertransformation to a- ColumnDataSourcecolumn.- Parameters:
- field_name (str) – a field name to configure - DataSpecwith
- palette (seq[color]) – a list of colors to use for colormapping 
- low (float) – a minimum value of the range to map into the palette. Values below this are clamped to - low.
- high (float) – a maximum value of the range to map into the palette. Values above this are clamped to - high.
- low_color (color, optional) – color to be used if data is lower than - lowvalue. If None, values lower than- loware mapped to the first color in the palette. (default: None)
- high_color (color, optional) – color to be used if data is higher than - highvalue. If None, values higher than- highare mapped to the last color in the palette. (default: None)
- nan_color (color, optional) – a default color to use when mapping data from a column does not succeed (default: “gray”) 
 
 
- factor_cmap(field_name: str, palette: Sequence[ColorLike], factors: Factors, start: float = 0, end: float | None = None, nan_color: ColorLike = 'gray') Field[source]#
- Create a - DataSpecdict that applies a client-side- CategoricalColorMappertransformation to a- ColumnDataSourcecolumn.- Parameters:
- field_name (str) – a field name to configure - DataSpecwith
- palette (seq[color]) – a list of colors to use for colormapping 
- factors (seq) – a sequence of categorical factors corresponding to the palette 
- start (int, optional) – a start slice index to apply when the column data has factors with multiple levels. (default: 0) 
- end (int, optional) – an end slice index to apply when the column data has factors with multiple levels. (default: None) 
- nan_color (color, optional) – a default color to use when mapping data from a column does not succeed (default: “gray”) 
 
- Returns:
- Field 
 
- factor_hatch(field_name: str, patterns: Sequence[str], factors: Factors, start: float = 0, end: float | None = None) Field[source]#
- Create a - DataSpecdict that applies a client-side- CategoricalPatternMappertransformation to a- ColumnDataSourcecolumn.- Parameters:
- field_name (str) – a field name to configure - DataSpecwith
- patterns (seq[string]) – a list of hatch patterns to use to map to 
- factors (seq) – a sequences of categorical factors corresponding to the palette 
- start (int, optional) – a start slice index to apply when the column data has factors with multiple levels. (default: 0) 
- end (int, optional) – an end slice index to apply when the column data has factors with multiple levels. (default: None) 
 
- Returns:
- Field 
 - Added in version 1.1.1 
- factor_mark(field_name: str, markers: Sequence[str], factors: Factors, start: float = 0, end: float | None = None) Field[source]#
- Create a - DataSpecdict that applies a client-side- CategoricalMarkerMappertransformation to a- ColumnDataSourcecolumn.- Note - This transform is primarily only useful with - scatter, which can be parameterized by glyph type.- Parameters:
- field_name (str) – a field name to configure - DataSpecwith
- markers (seq[string]) – a list of markers to use to map to 
- factors (seq) – a sequences of categorical factors corresponding to the palette 
- start (int, optional) – a start slice index to apply when the column data has factors with multiple levels. (default: 0) 
- end (int, optional) – an end slice index to apply when the column data has factors with multiple levels. (default: None) 
 
- Returns:
- Field 
 
- jitter(field_name: str, width: float, mean: float = 0, distribution: JitterRandomDistributionType = 'uniform', range: Range | None = None) Field[source]#
- Create a - DataSpecdict that applies a client-side- Jittertransformation to a- ColumnDataSourcecolumn.- Parameters:
- field_name (str) – a field name to configure - DataSpecwith
- width (float) – the width of the random distribution to apply 
- mean (float, optional) – an offset to apply (default: 0) 
- distribution (str, optional) – - "uniform"or- "normal"(default:- "uniform")
- range (Range, optional) – a range to use for computing synthetic coordinates when necessary, e.g. a - FactorRangewhen the column data is categorical (default: None)
 
- Returns:
- Field 
 
- linear_cmap(field_name: str, palette: Sequence[ColorLike], low: float, high: float, low_color: ColorLike | None = None, high_color: ColorLike | None = None, nan_color: ColorLike = 'gray') Field[source]#
- Create a - DataSpecdict that applies a client-side- LinearColorMappertransformation to a- ColumnDataSourcecolumn.- Parameters:
- field_name (str) – a field name to configure - DataSpecwith
- palette (seq[color]) – a list of colors to use for colormapping 
- low (float) – a minimum value of the range to map into the palette. Values below this are clamped to - low.
- high (float) – a maximum value of the range to map into the palette. Values above this are clamped to - high.
- low_color (color, optional) – color to be used if data is lower than - lowvalue. If None, values lower than- loware mapped to the first color in the palette. (default: None)
- high_color (color, optional) – color to be used if data is higher than - highvalue. If None, values higher than- highare mapped to the last color in the palette. (default: None)
- nan_color (color, optional) – a default color to use when mapping data from a column does not succeed (default: “gray”) 
 
 
- log_cmap(field_name: str, palette: Sequence[ColorLike], low: float, high: float, low_color: ColorLike | None = None, high_color: ColorLike | None = None, nan_color: ColorLike = 'gray') Field[source]#
- Create a - DataSpecdict that applies a client-side- LogColorMappertransformation to a- ColumnDataSourcecolumn.- Parameters:
- field_name (str) – a field name to configure - DataSpecwith
- palette (seq[color]) – a list of colors to use for colormapping 
- low (float) – a minimum value of the range to map into the palette. Values below this are clamped to - low.
- high (float) – a maximum value of the range to map into the palette. Values above this are clamped to - high.
- low_color (color, optional) – color to be used if data is lower than - lowvalue. If None, values lower than- loware mapped to the first color in the palette. (default: None)
- high_color (color, optional) – color to be used if data is higher than - highvalue. If None, values higher than- highare mapped to the last color in the palette. (default: None)
- nan_color (color, optional) – a default color to use when mapping data from a column does not succeed (default: “gray”) 
 
 
- stack(*fields: str) Expr[source]#
- Create a Create a - DataSpecdict to generate a- Stackexpression for a- ColumnDataSource.- Examples - p.vbar(bottom=stack("sales", "marketing"), ... - will generate a - Stackthat sums the- "sales"and- "marketing"columns of a data source, and use those values as the- topcoordinate for a- VBar.