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.

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, visible

panel.pane.base.PaneBase: margin, default_layout

object = param.ClassSelector(allow_None=True, allow_refs=True, class_=<class ‘holoviews.core.element.Element’>, label=’Object’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x12fe6c650>)

The Element to edit and annotate.

annotations = param.ClassSelector(allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default=[], label=’Annotations’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1382be550>)

Annotations to associate with each object.

default_opts = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘responsive’: True, ‘min_height’: 400, ‘padding’: 0.1, ‘framewise’: True}, label=’Default opts’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x12fb92090>)

Opts to apply to the element.

empty_value = param.Parameter(allow_None=True, allow_refs=False, label=’Empty value’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x12fd45e10>)

The value to insert on annotation columns when drawing a new element.

num_objects = param.Integer(allow_None=True, allow_refs=False, bounds=(0, None), inclusive_bounds=(True, True), label=’Num objects’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x12fb76150>)

The maximum number of objects to draw.

table_transforms = param.HookList(allow_refs=False, bounds=(0, None), default=[], label=’Table transforms’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1382a47d0>)

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 = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘editable’: True, ‘width’: 400}, label=’Table opts’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x12fe6c650>)

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

default_layout[source]#

alias of Row

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.

Arguments#

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.

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, visible

panel.pane.base.PaneBase: margin, default_layout

holoviews.annotators.Annotator: annotations, empty_value, num_objects, table_transforms, table_opts

object = param.ClassSelector(allow_None=True, allow_refs=True, class_=<class ‘holoviews.element.chart.Curve’>, label=’Object’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1383f1a50>)

Points element to edit and annotate.

default_opts = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘responsive’: True, ‘min_height’: 400, ‘padding’: 0.1, ‘framewise’: True}, label=’Default opts’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1383e5e50>)

Opts to apply to the element.

vertex_style = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘size’: 10}, label=’Vertex style’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1383f3ed0>)

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

default_layout[source]#

alias of Row

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.

Arguments#

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.

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, visible

panel.pane.base.PaneBase: margin, default_layout

holoviews.annotators.Annotator: annotations, default_opts, empty_value, num_objects, table_transforms, table_opts

object = param.ClassSelector(allow_None=True, allow_refs=True, class_=<class ‘holoviews.element.path.Path’>, label=’Object’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1383dc650>)

Path object to edit and annotate.

edit_vertices = param.Boolean(allow_refs=False, default=True, label=’Edit vertices’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x138400790>)

Whether to add tool to edit vertices.

show_vertices = param.Boolean(allow_refs=False, default=True, label=’Show vertices’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1383d0950>)

Whether to show vertices when drawing the Path.

vertex_annotations = param.ClassSelector(allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default=[], label=’Vertex annotations’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x138402d10>)

Columns to annotate the Polygons with.

vertex_style = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘nonselection_alpha’: 0.5}, label=’Vertex style’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x138400790>)

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

default_layout[source]#

alias of Row

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.

Arguments#

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.

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, visible

panel.pane.base.PaneBase: margin, default_layout

holoviews.annotators.Annotator: annotations, empty_value, num_objects, table_transforms, table_opts

object = param.ClassSelector(allow_None=True, allow_refs=True, class_=<class ‘holoviews.element.geom.Points’>, label=’Object’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x139575d50>)

Points element to edit and annotate.

default_opts = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘responsive’: True, ‘min_height’: 400, ‘padding’: 0.1, ‘size’: 10, ‘framewise’: True}, label=’Default opts’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x139584710>)

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

default_layout[source]#

alias of Row

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.

Arguments#

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.

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, visible

panel.pane.base.PaneBase: margin, default_layout

holoviews.annotators.Annotator: annotations, default_opts, empty_value, num_objects, table_transforms, table_opts

holoviews.annotators.PathAnnotator: edit_vertices, show_vertices, vertex_annotations, vertex_style

object = param.ClassSelector(allow_None=True, allow_refs=True, class_=<class ‘holoviews.element.path.Polygons’>, label=’Object’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1383a2bd0>)

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

default_layout[source]#

alias of Row

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.

Arguments#

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.

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, visible

panel.pane.base.PaneBase: margin, default_layout

holoviews.annotators.Annotator: annotations, empty_value, num_objects, table_transforms, table_opts

holoviews.annotators._GeomAnnotator: default_opts

object = param.ClassSelector(allow_None=True, allow_refs=True, class_=<class ‘holoviews.element.geom.Rectangles’>, label=’Object’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x13827bad0>)

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

default_layout[source]#

alias of Row

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.

Arguments#

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.

annotator = param.Parameter(allow_None=True, allow_refs=False, label=’Annotator’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x139618850>)

The current Annotator instance.

annotations = param.ClassSelector(allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default=[], label=’Annotations’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1396495d0>)

Annotations to associate with each object.

edit_vertices = param.Boolean(allow_refs=False, default=True, label=’Edit vertices’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x139619650>)

Whether to add tool to edit vertices.

empty_value = param.Parameter(allow_None=True, allow_refs=False, label=’Empty value’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x139649290>)

The value to insert on annotation columns when drawing a new element.

num_objects = param.Integer(allow_None=True, allow_refs=False, bounds=(0, None), inclusive_bounds=(True, True), label=’Num objects’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1383b8c50>)

The maximum number of objects to draw.

show_vertices = param.Boolean(allow_refs=False, default=True, label=’Show vertices’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x13964b310>)

Whether to show vertices when drawing the Path.

table_transforms = param.HookList(allow_refs=False, bounds=(0, None), default=[], label=’Table transforms’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x12feb4150>)

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 = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘editable’: True, ‘width’: 400}, label=’Table opts’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x139649c50>)

Opts to apply to the editor table(s).

vertex_annotations = param.ClassSelector(allow_refs=False, class_=(<class ‘dict’>, <class ‘list’>), default=[], label=’Vertex annotations’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x13958a890>)

Columns to annotate the Polygons with.

vertex_style = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘nonselection_alpha’: 0.5}, label=’Vertex style’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x139648350>)

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

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

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)