holoviews.element.annotation module#

class holoviews.element.annotation.Annotation(data, **params)[source]#

Bases: Element2D

An Annotation is a special type of element that is designed to be overlaid on top of any arbitrary 2D element. Annotations have neither key nor value dimensions allowing them to be overlaid over any type of data.

Note that one or more Annotations can be displayed without being overlaid on top of any other data. In such instances (by default) they will be displayed using the unit axis limits (0.0-1.0 in both directions) unless an explicit ‘extents’ parameter is supplied. The extents of the bottom Annotation in the Overlay is used when multiple Annotations are displayed together.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Annotation', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('x'), Dimension('y')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

clone(*args, **overrides)[source]#

Clones the object, overriding data and parameters.

Parameters#

data

New data replacing the existing data

shared_databool, optional

Whether to use existing data

new_typeoptional

Type to cast object to

linkbool, optional

Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.

*args

Additional arguments to pass to constructor

**overrides

New keyword arguments to pass to constructor

Returns#

Cloned object

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.annotation.Arrow(x, y, text='', direction='<', points=40, arrowstyle='->', **params)[source]#

Bases: Annotation

Draw an arrow to the given xy position with optional text at distance ‘points’ away. The direction of the arrow may be specified as well as the arrow head style.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Arrow', label='Group')

A string describing the data wrapped by the object.

x = ClassSelector(class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X')

The x-position of the arrow which make be numeric or a timestamp.

y = ClassSelector(class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y')

The y-position of the arrow which make be numeric or a timestamp.

text = String(default='', label='Text')

Text associated with the arrow.

direction = Selector(default='<', label='Direction', names={}, objects=['<', '^', '>', 'v'])

The cardinal direction in which the arrow is pointing. Accepted arrow directions are ‘<’, ‘^’, ‘>’ and ‘v’.

arrowstyle = Selector(default='->', label='Arrowstyle', names={}, objects=['-', '->', '-[', '-|>', '<->', '<|-|>'])

The arrowstyle used to draw the arrow. Accepted arrow styles are ‘-’, ‘->’, ‘-[’, ‘-|>', '<->' and '<|-|>’

points = Number(default=40, inclusive_bounds=(True, True), label='Points')

Font size of arrow text (if any).

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.annotation.Div(data, **params)[source]#

Bases: Element

The Div element represents a div DOM node in an HTML document defined as a string containing valid HTML.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Div', label='Group')

A string describing the data wrapped by the object.

class holoviews.element.annotation.HLine(y, **params)[source]#

Bases: Annotation

Horizontal line annotation at the given position.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HLine', label='Group')

A string describing the data wrapped by the object.

y = ClassSelector(class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y')

The y-position of the HLine which make be numeric or a timestamp.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.annotation.HLines(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: VectorizedAnnotation

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HLines', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(1, 1), default=[Dimension('y')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class holoviews.element.annotation.HSpan(y1=None, y2=None, **params)[source]#

Bases: Annotation

Horizontal span annotation at the given position.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HSpan', label='Group')

A string describing the data wrapped by the object.

y1 = ClassSelector(allow_None=True, class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y1')

The start y-position of the VSpan which must be numeric or a timestamp.

y2 = ClassSelector(allow_None=True, class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y2')

The end y-position of the VSpan which must be numeric or a timestamp.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.annotation.HSpans(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: VectorizedAnnotation

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HSpans', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('y0'), Dimension('y1')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class holoviews.element.annotation.Labels(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Dataset, Element2D

Labels represents a collection of text labels associated with 2D coordinates. Unlike the Text annotation, Labels is a Dataset type which allows drawing vectorized labels from tabular or gridded data.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Labels', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), constant=True, default=[Dimension('x'), Dimension('y')], label='Kdims')

The label of the x- and y-dimension of the Labels element in form of a string or dimension object.

vdims = List(bounds=(1, None), default=[Dimension('Label')], label='Vdims')

Defines the value dimension corresponding to the label text.

class holoviews.element.annotation.Slope(slope, y_intercept, kdims=None, vdims=None, **params)[source]#

Bases: Annotation

A line drawn with arbitrary slope and y-intercept

Parameter Definitions


Parameters inherited from:

slope = Number(default=0, inclusive_bounds=(True, True), label='Slope')

y_intercept = Number(default=0, inclusive_bounds=(True, True), label='Y intercept')

classmethod from_scatter(element, **kwargs)[source]#

Returns a Slope element given an element of x/y-coordinates

Computes the slope and y-intercept from an element containing x- and y-coordinates.

Parameters#

element

Element to compute slope from

kwargs

Keyword arguments to pass to the Slope element

Returns#

Slope element

class holoviews.element.annotation.Spline(spline_points, **params)[source]#

Bases: Annotation

Draw a spline using the given handle coordinates and handle codes. The constructor accepts a tuple in format (coords, codes).

Follows format of matplotlib spline definitions as used in matplotlib.path.Path with the following codes:

Path.STOP : 0 Path.MOVETO : 1 Path.LINETO : 2 Path.CURVE3 : 3 Path.CURVE4 : 4 Path.CLOSEPLOY: 79

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Spline', label='Group')

A string describing the data wrapped by the object.

clone(data=None, shared_data=True, new_type=None, *args, **overrides)[source]#

Clones the object, overriding data and parameters.

Parameters#

data

New data replacing the existing data

shared_databool, optional

Whether to use existing data

new_typeoptional

Type to cast object to

*args: Additional arguments to pass to constructor **overrides: New keyword arguments to pass to constructor

Returns#

Cloned Spline

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension : The dimension to return values for expanded : bool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.annotation.Text(x, y, text, fontsize=12, halign='center', valign='center', rotation=0, **params)[source]#

Bases: Annotation

Draw a text annotation at the specified position with custom fontsize, alignment and rotation.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Text', label='Group')

A string describing the data wrapped by the object.

x = ClassSelector(class_=(<class 'numbers.Number'>, <class 'str'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X')

The x-position of the arrow which make be numeric or a timestamp.

y = ClassSelector(class_=(<class 'numbers.Number'>, <class 'str'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y')

The y-position of the arrow which make be numeric or a timestamp.

text = String(default='', label='Text')

The text to be displayed.

fontsize = Number(default=12, inclusive_bounds=(True, True), label='Fontsize')

Font size of the text.

rotation = Number(default=0, inclusive_bounds=(True, True), label='Rotation')

Text rotation angle in degrees.

halign = Selector(default='center', label='Halign', names={}, objects=['left', 'right', 'center'])

The horizontal alignment position of the displayed text. Allowed values are ‘left’, ‘right’ and ‘center’.

valign = Selector(default='center', label='Valign', names={}, objects=['top', 'bottom', 'center'])

The vertical alignment position of the displayed text. Allowed values are ‘center’, ‘top’ and ‘bottom’.

class holoviews.element.annotation.VLine(x, **params)[source]#

Bases: Annotation

Vertical line annotation at the given position.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VLine', label='Group')

A string describing the data wrapped by the object.

x = ClassSelector(class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X')

The x-position of the VLine which make be numeric or a timestamp.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.annotation.VLines(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: VectorizedAnnotation

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VLines', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(1, 1), default=[Dimension('x')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class holoviews.element.annotation.VSpan(x1=None, x2=None, **params)[source]#

Bases: Annotation

Vertical span annotation at the given position.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VSpan', label='Group')

A string describing the data wrapped by the object.

x1 = ClassSelector(allow_None=True, class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X1')

The start x-position of the VSpan which must be numeric or a timestamp.

x2 = ClassSelector(allow_None=True, class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X2')

The end x-position of the VSpan which must be numeric or a timestamp.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.annotation.VSpans(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: VectorizedAnnotation

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VSpans', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('x0'), Dimension('x1')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class holoviews.element.annotation.VectorizedAnnotation(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Dataset, Element2D

Parameter Definitions


Parameters inherited from: