annotators Module#
annotators
Module#
- class holoviews.annotators.Annotator(object=None, **params)[source]#
Bases:
PaneBase
An Annotator allows drawing, editing and annotating a specific type of element. Each Annotator consists of the plot to draw and edit the element and the editor, which contains a list of tables, which make it possible to annotate each object in the element with additional properties defined in the annotations.
Parameter Definitions
Parameters inherited from:
panel.viewable.Layoutable
: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visiblepanel.pane.base.PaneBase
: margin, default_layoutobject = ClassSelector(allow_None=True, allow_refs=True, class_=<class 'holoviews.core.element.Element'>, label='Object')
The Element to edit and annotate.
annotations = ClassSelector(class_=(<class 'dict'>, <class 'list'>), default=[], label='Annotations')
Annotations to associate with each object.
default_opts = Dict(class_=<class 'dict'>, default={'responsive': True, 'min_height': 400, 'padding': 0.1, 'framewise': True}, label='Default opts')
Opts to apply to the element.
empty_value = Parameter(allow_None=True, label='Empty value')
The value to insert on annotation columns when drawing a new element.
num_objects = Integer(allow_None=True, bounds=(0, None), inclusive_bounds=(True, True), label='Num objects')
The maximum number of objects to draw.
table_transforms = HookList(bounds=(0, None), default=[], label='Table transforms')
Transform(s) to apply to element when converting data to Table. The functions should accept the Annotator and the transformed element as input.
table_opts = Dict(class_=<class 'dict'>, default={'editable': True, 'width': 400}, label='Table opts')
Opts to apply to the editor table(s).
- classmethod applies(obj)[source]#
Returns boolean or float indicating whether the Pane can render the object.
If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.
- classmethod compose(*annotators)[source]#
Composes multiple Annotator instances and elements
The composed Panel will contain all the elements in the supplied Annotators and Tabs containing all editors.
- Args:
annotators: Annotator objects or elements to compose
- Returns:
A new Panel consisting of the overlaid plots and tables
- classmethod get_pane_type(obj: Any, **kwargs) type[PaneBase] [source]#
Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.
Parameters#
obj (object): The object type to return a Pane type for
Returns#
The applicable Pane type with the highest precedence.
- class holoviews.annotators.CurveAnnotator(object=None, **params)[source]#
Bases:
_GeomAnnotator
Annotator which allows editing a Curve element and associating values with each vertex using a Table.
Parameter Definitions
Parameters inherited from:
panel.viewable.Layoutable
: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visiblepanel.pane.base.PaneBase
: margin, default_layoutholoviews.annotators.Annotator
: annotations, empty_value, num_objects, table_transforms, table_optsobject = ClassSelector(allow_None=True, allow_refs=True, class_=<class 'holoviews.element.chart.Curve'>, label='Object')
Points element to edit and annotate.
default_opts = Dict(class_=<class 'dict'>, default={'responsive': True, 'min_height': 400, 'padding': 0.1, 'framewise': True}, label='Default opts')
Opts to apply to the element.
vertex_style = Dict(class_=<class 'dict'>, default={'size': 10}, label='Vertex style')
Options to apply to vertices during drawing and editing.
- classmethod applies(obj)[source]#
Returns boolean or float indicating whether the Pane can render the object.
If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.
- classmethod compose(*annotators)[source]#
Composes multiple Annotator instances and elements
The composed Panel will contain all the elements in the supplied Annotators and Tabs containing all editors.
- Args:
annotators: Annotator objects or elements to compose
- Returns:
A new Panel consisting of the overlaid plots and tables
- classmethod get_pane_type(obj: Any, **kwargs) type[PaneBase] [source]#
Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.
Parameters#
obj (object): The object type to return a Pane type for
Returns#
The applicable Pane type with the highest precedence.
- class holoviews.annotators.PathAnnotator(object=None, **params)[source]#
Bases:
Annotator
Annotator which allows drawing and editing Paths and associating values with each path and each vertex of a path using a table.
Parameter Definitions
Parameters inherited from:
panel.viewable.Layoutable
: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visiblepanel.pane.base.PaneBase
: margin, default_layoutholoviews.annotators.Annotator
: annotations, default_opts, empty_value, num_objects, table_transforms, table_optsobject = ClassSelector(allow_None=True, allow_refs=True, class_=<class 'holoviews.element.path.Path'>, label='Object')
Path object to edit and annotate.
edit_vertices = Boolean(default=True, label='Edit vertices')
Whether to add tool to edit vertices.
show_vertices = Boolean(default=True, label='Show vertices')
Whether to show vertices when drawing the Path.
vertex_annotations = ClassSelector(class_=(<class 'dict'>, <class 'list'>), default=[], label='Vertex annotations')
Columns to annotate the Polygons with.
vertex_style = Dict(class_=<class 'dict'>, default={'nonselection_alpha': 0.5}, label='Vertex style')
Options to apply to vertices during drawing and editing.
- classmethod applies(obj)[source]#
Returns boolean or float indicating whether the Pane can render the object.
If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.
- classmethod compose(*annotators)[source]#
Composes multiple Annotator instances and elements
The composed Panel will contain all the elements in the supplied Annotators and Tabs containing all editors.
- Args:
annotators: Annotator objects or elements to compose
- Returns:
A new Panel consisting of the overlaid plots and tables
- classmethod get_pane_type(obj: Any, **kwargs) type[PaneBase] [source]#
Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.
Parameters#
obj (object): The object type to return a Pane type for
Returns#
The applicable Pane type with the highest precedence.
- class holoviews.annotators.PointAnnotator(object=None, **params)[source]#
Bases:
_GeomAnnotator
Annotator which allows drawing and editing Points and associating values with each point using a table.
Parameter Definitions
Parameters inherited from:
panel.viewable.Layoutable
: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visiblepanel.pane.base.PaneBase
: margin, default_layoutholoviews.annotators.Annotator
: annotations, empty_value, num_objects, table_transforms, table_optsobject = ClassSelector(allow_None=True, allow_refs=True, class_=<class 'holoviews.element.geom.Points'>, label='Object')
Points element to edit and annotate.
default_opts = Dict(class_=<class 'dict'>, default={'responsive': True, 'min_height': 400, 'padding': 0.1, 'size': 10, 'framewise': True}, label='Default opts')
Opts to apply to the element.
- classmethod applies(obj)[source]#
Returns boolean or float indicating whether the Pane can render the object.
If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.
- classmethod compose(*annotators)[source]#
Composes multiple Annotator instances and elements
The composed Panel will contain all the elements in the supplied Annotators and Tabs containing all editors.
- Args:
annotators: Annotator objects or elements to compose
- Returns:
A new Panel consisting of the overlaid plots and tables
- classmethod get_pane_type(obj: Any, **kwargs) type[PaneBase] [source]#
Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.
Parameters#
obj (object): The object type to return a Pane type for
Returns#
The applicable Pane type with the highest precedence.
- class holoviews.annotators.PolyAnnotator(object=None, **params)[source]#
Bases:
PathAnnotator
Annotator which allows drawing and editing Polygons and associating values with each polygon and each vertex of a Polygon using a table.
Parameter Definitions
Parameters inherited from:
panel.viewable.Layoutable
: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visiblepanel.pane.base.PaneBase
: margin, default_layoutholoviews.annotators.Annotator
: annotations, default_opts, empty_value, num_objects, table_transforms, table_optsholoviews.annotators.PathAnnotator
: edit_vertices, show_vertices, vertex_annotations, vertex_styleobject = ClassSelector(allow_None=True, allow_refs=True, class_=<class 'holoviews.element.path.Polygons'>, label='Object')
Polygon element to edit and annotate.
- classmethod applies(obj)[source]#
Returns boolean or float indicating whether the Pane can render the object.
If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.
- classmethod compose(*annotators)[source]#
Composes multiple Annotator instances and elements
The composed Panel will contain all the elements in the supplied Annotators and Tabs containing all editors.
- Args:
annotators: Annotator objects or elements to compose
- Returns:
A new Panel consisting of the overlaid plots and tables
- classmethod get_pane_type(obj: Any, **kwargs) type[PaneBase] [source]#
Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.
Parameters#
obj (object): The object type to return a Pane type for
Returns#
The applicable Pane type with the highest precedence.
- class holoviews.annotators.RectangleAnnotator(object=None, **params)[source]#
Bases:
_GeomAnnotator
Annotator which allows drawing and editing Rectangles and associating values with each point using a table.
Parameter Definitions
Parameters inherited from:
panel.viewable.Layoutable
: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visiblepanel.pane.base.PaneBase
: margin, default_layoutholoviews.annotators.Annotator
: annotations, empty_value, num_objects, table_transforms, table_optsholoviews.annotators._GeomAnnotator
: default_optsobject = ClassSelector(allow_None=True, allow_refs=True, class_=<class 'holoviews.element.geom.Rectangles'>, label='Object')
Points element to edit and annotate.
- classmethod applies(obj)[source]#
Returns boolean or float indicating whether the Pane can render the object.
If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.
- classmethod compose(*annotators)[source]#
Composes multiple Annotator instances and elements
The composed Panel will contain all the elements in the supplied Annotators and Tabs containing all editors.
- Args:
annotators: Annotator objects or elements to compose
- Returns:
A new Panel consisting of the overlaid plots and tables
- classmethod get_pane_type(obj: Any, **kwargs) type[PaneBase] [source]#
Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.
Parameters#
obj (object): The object type to return a Pane type for
Returns#
The applicable Pane type with the highest precedence.
- class holoviews.annotators.annotate(*, annotations, annotator, edit_vertices, empty_value, num_objects, show_vertices, table_opts, table_transforms, vertex_annotations, vertex_style, name)[source]#
Bases:
ParameterizedFunction
The annotate function allows drawing, editing and annotating any given Element (if it is supported). The annotate function returns a Layout of the editable plot and an Overlay of table(s), which allow editing the data of the element. The edited and annotated data may be accessed using the element and selected properties.
Parameter Definitions
annotator = Parameter(allow_None=True, label='Annotator')
The current Annotator instance.
annotations = ClassSelector(class_=(<class 'dict'>, <class 'list'>), default=[], label='Annotations')
Annotations to associate with each object.
edit_vertices = Boolean(default=True, label='Edit vertices')
Whether to add tool to edit vertices.
empty_value = Parameter(allow_None=True, label='Empty value')
The value to insert on annotation columns when drawing a new element.
num_objects = Integer(allow_None=True, bounds=(0, None), inclusive_bounds=(True, True), label='Num objects')
The maximum number of objects to draw.
show_vertices = Boolean(default=True, label='Show vertices')
Whether to show vertices when drawing the Path.
table_transforms = HookList(bounds=(0, None), default=[], label='Table transforms')
Transform(s) to apply to element when converting data to Table. The functions should accept the Annotator and the transformed element as input.
table_opts = Dict(class_=<class 'dict'>, default={'editable': True, 'width': 400}, label='Table opts')
Opts to apply to the editor table(s).
vertex_annotations = ClassSelector(class_=(<class 'dict'>, <class 'list'>), default=[], label='Vertex annotations')
Columns to annotate the Polygons with.
vertex_style = Dict(class_=<class 'dict'>, default={'nonselection_alpha': 0.5}, label='Vertex style')
Options to apply to vertices during drawing and editing.
- classmethod compose(*annotators)[source]#
Composes multiple annotator layouts and elements
The composed Layout will contain all the elements in the supplied annotators and an overlay of all editor tables.
- Args:
annotators: Annotator layouts or elements to compose
- Returns:
A new layout consisting of the overlaid plots and tables
- holoviews.annotators.preprocess(function, current=None)[source]#
Turns a param.depends watch call into a preprocessor method, i.e. skips all downstream events triggered by it. NOTE: This is a temporary hack while the addition of preprocessors
in param is under discussion. This only works for the first method which depends on a particular parameter. (see pyviz/param#332)