holoviews.selection module#
- class holoviews.selection.ColorListSelectionDisplay(color_prop='color', alpha_prop='alpha', backend=None)[source]#
Bases:
SelectionDisplaySelection display class for elements that support coloring by a vectorized color list.
- class holoviews.selection.NoOpSelectionDisplay[source]#
Bases:
SelectionDisplaySelection display class that returns input element unchanged. For use with elements that don’t support displaying selections.
- class holoviews.selection.OverlaySelectionDisplay(color_prop='color', is_cmap=False, supports_region=True)[source]#
Bases:
SelectionDisplaySelection display base class that represents selections by overlaying colored subsets on top of the original element in an Overlay container.
- class holoviews.selection.SelectionDisplay[source]#
Bases:
objectBase class for selection display classes. Selection display classes are responsible for transforming an element (or DynamicMap that produces an element) into a HoloViews object that represents the current selection state.
- class holoviews.selection.link_selections(*, cross_filter_mode, index_cols, selected_color, selection_expr, selection_mode, unselected_alpha, unselected_color, link_inputs, show_regions, name)[source]#
Bases:
_base_link_selectionsOperation which automatically links selections between elements in the supplied HoloViews object. Can be used a single time or be used as an instance to apply the linked selections across multiple objects.
- Attributes:
selected_cmapThe datashader colormap for selected data
unselected_cmapThe datashader colormap for unselected data
Methods
filter(data[, selection_expr])Filters the provided data based on the current state of the current selection expression.
instance(**params)Create and return an instance of this class.
selection_param(data)Returns a parameter which reflects the current selection when applied to the supplied data, making it easy to create a callback which depends on the current selection.
Parameter Definitions
Parameters inherited from:
holoviews.selection._base_link_selections: link_inputs, show_regionscross_filter_mode = Selector(default='intersect', label='Cross filter mode', names={}, objects=['overwrite', 'intersect'])Determines how to combine selections across different elements.
index_cols = List(allow_None=True, bounds=(0, None), label='Index cols')If provided, selection switches to index mode where all queries are expressed solely in terms of discrete values along the index_cols. All Elements given to link_selections must define the index_cols, either as explicit dimensions or by sharing an underlying Dataset that defines them.
selection_expr = Parameter(allow_None=True, label='Selection expr')dim expression of the current selection or None to indicate that everything is selected.
selected_color = Color(allow_None=True, allow_named=True, label='Selected color')Color of selected data, or None to use the original color of each element.
selection_mode = Selector(default='overwrite', label='Selection mode', names={}, objects=['overwrite', 'intersect', 'union', 'inverse'])Determines how to combine successive selections on the same element.
unselected_alpha = Magnitude(bounds=(0.0, 1.0), default=0.1, inclusive_bounds=(True, True), label='Unselected alpha')Alpha of unselected data.
unselected_color = Color(allow_None=True, allow_named=True, label='Unselected color')Color of unselected data.
- filter(data, selection_expr=None)[source]#
Filters the provided data based on the current state of the current selection expression.
- Parameters:
- data
A Dataset type or data which can be cast to a Dataset
- selection_expr
Optionally provide your own selection expression
- Returns:
Thefiltereddata
- instance(**params)[source]#
Create and return an instance of this class.
This method returns an instance of the
ParameterizedFunctionclass, copying parameter values from any existing instance provided or initializing them with the specifiedparams.This method is useful for obtaining a persistent object representation of a
ParameterizedFunctionwithout triggering its execution (__call__).- Parameters:
- **params
dict Parameter values to initialize the instance with. If an existing instance is used, its parameters are copied and updated with the provided values.
- **params
- Returns:
ParameterizedFunctionAn instance of the class with the specified or inherited parameters.
References
See https://param.holoviz.org/user_guide/ParameterizedFunctions.html
Examples
Create an instance with default parameters:
>>> import param >>> class Scale(param.ParameterizedFunction): ... multiplier = param.Number(default=2, bounds=(0, 10), doc="The multiplier value.") ... >>> instance = Scale.instance() >>> instance.multiplier 2
Use the instance:
>>> instance(5) 10
- property selected_cmap#
The datashader colormap for selected data
- selection_param(data)[source]#
Returns a parameter which reflects the current selection when applied to the supplied data, making it easy to create a callback which depends on the current selection.
- Parameters:
- data
A Dataset type or data which can be cast to a Dataset
- Returns:
Aparameterwhichreflectsthecurrentselection
- property unselected_cmap#
The datashader colormap for unselected data