holoviews.element.annotation module#
- class holoviews.element.annotation.Annotation(data, **params)[source]#
Bases:
Element2DAn 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.
Methods
clone(*args, **overrides)Clones the object, overriding data and parameters.
dimension_values(dimension[, expanded, flat])Return the values along the requested dimension.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsgroup = 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_type
optional 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:
Clonedobject
- dimension_values(dimension, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
- Parameters:
- dimension
str The dimension to return values for.
- expandedbool,
optional Whether to return the expanded values. Behavior depends on the type of data:
Columnar: If false, returns unique values
Geometry: If false, returns scalar values per geometry
Gridded: If false, returns 1D coordinates
- flatbool,
optional Whether to flatten array.
- dimension
- Returns:
np.ndarrayArray of values along the requested dimension.
- class holoviews.element.annotation.Arrow(x, y, text='', direction='<', points=40, arrowstyle='->', **params)[source]#
Bases:
AnnotationDraw 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.
Methods
dimension_values(dimension[, expanded, flat])Return the values along the requested dimension.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsgroup = String(constant=True, default='Arrow', label='Group')A string describing the data wrapped by the object.
x = ClassSelector(class_=(<class 'numbers.Number'>, <class 'holoviews.core.util.types.datetime_types'>), default=0, label='X')The x-position of the arrow which make be numeric or a timestamp.
y = ClassSelector(class_=(<class 'numbers.Number'>, <class 'holoviews.core.util.types.datetime_types'>), 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
str The dimension to return values for.
- expandedbool,
optional Whether to return the expanded values. Behavior depends on the type of data:
Columnar: If false, returns unique values
Geometry: If false, returns scalar values per geometry
Gridded: If false, returns 1D coordinates
- flatbool,
optional Whether to flatten array.
- dimension
- Returns:
np.ndarrayArray of values along the requested dimension.
- class holoviews.element.annotation.Div(data, **params)[source]#
Bases:
ElementThe Div element represents a div DOM node in an HTML document defined as a string containing valid HTML.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, kdims, vdimsgroup = 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:
AnnotationHorizontal line annotation at the given position.
Methods
dimension_values(dimension[, expanded, flat])Return the values along the requested dimension.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsgroup = String(constant=True, default='HLine', label='Group')A string describing the data wrapped by the object.
y = ClassSelector(class_=(<class 'numbers.Number'>, <class 'holoviews.core.util.types.datetime_types'>), 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
str The dimension to return values for.
- expandedbool,
optional Whether to return the expanded values. Behavior depends on the type of data:
Columnar: If false, returns unique values
Geometry: If false, returns scalar values per geometry
Gridded: If false, returns 1D coordinates
- flatbool,
optional Whether to flatten array.
- dimension
- Returns:
np.ndarrayArray of values along the requested dimension.
- class holoviews.element.annotation.HLines(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
VectorizedAnnotationParameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsholoviews.core.data.Dataset: datatypegroup = 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:
AnnotationHorizontal span annotation at the given position.
Methods
dimension_values(dimension[, expanded, flat])Return the values along the requested dimension.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsgroup = 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 'holoviews.core.util.types.datetime_types'>), 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 'holoviews.core.util.types.datetime_types'>), 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
str The dimension to return values for.
- expandedbool,
optional Whether to return the expanded values. Behavior depends on the type of data:
Columnar: If false, returns unique values
Geometry: If false, returns scalar values per geometry
Gridded: If false, returns 1D coordinates
- flatbool,
optional Whether to flatten array.
- dimension
- Returns:
np.ndarrayArray of values along the requested dimension.
- class holoviews.element.annotation.HSpans(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
VectorizedAnnotationParameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsholoviews.core.data.Dataset: datatypegroup = 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]#
-
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:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdimsholoviews.core.element.Element2D: extentsholoviews.core.data.Dataset: datatypegroup = 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:
AnnotationA line drawn with arbitrary slope and y-intercept
Methods
from_scatter(element, **kwargs)Returns a Slope element given an element of x/y-coordinates
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsholoviews.element.annotation.Annotation: group, kdimsslope = 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:
Slopeelement
- class holoviews.element.annotation.Spline(spline_points, **params)[source]#
Bases:
AnnotationDraw 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
Methods
clone([data, shared_data, new_type])Clones the object, overriding data and parameters.
dimension_values(dimension[, expanded, flat])Return the values along the requested dimension.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsgroup = 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.
- dimension_values(dimension, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
- Parameters:
- dimension
str The dimension to return values for.
- expandedbool,
optional Whether to return the expanded values. Behavior depends on the type of data:
Columnar: If false, returns unique values
Geometry: If false, returns scalar values per geometry
Gridded: If false, returns 1D coordinates
- flatbool,
optional Whether to flatten array.
- dimension
- Returns:
np.ndarrayArray 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:
AnnotationDraw a text annotation at the specified position with custom fontsize, alignment and rotation.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsgroup = 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 'holoviews.core.util.types.datetime_types'>), 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 'holoviews.core.util.types.datetime_types'>), 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:
AnnotationVertical line annotation at the given position.
Methods
dimension_values(dimension[, expanded, flat])Return the values along the requested dimension.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsgroup = String(constant=True, default='VLine', label='Group')A string describing the data wrapped by the object.
x = ClassSelector(class_=(<class 'numbers.Number'>, <class 'holoviews.core.util.types.datetime_types'>), 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
str The dimension to return values for.
- expandedbool,
optional Whether to return the expanded values. Behavior depends on the type of data:
Columnar: If false, returns unique values
Geometry: If false, returns scalar values per geometry
Gridded: If false, returns 1D coordinates
- flatbool,
optional Whether to flatten array.
- dimension
- Returns:
np.ndarrayArray of values along the requested dimension.
- class holoviews.element.annotation.VLines(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
VectorizedAnnotationParameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsholoviews.core.data.Dataset: datatypegroup = 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:
AnnotationVertical span annotation at the given position.
Methods
dimension_values(dimension[, expanded, flat])Return the values along the requested dimension.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsgroup = 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 'holoviews.core.util.types.datetime_types'>), 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 'holoviews.core.util.types.datetime_types'>), 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
str The dimension to return values for.
- expandedbool,
optional Whether to return the expanded values. Behavior depends on the type of data:
Columnar: If false, returns unique values
Geometry: If false, returns scalar values per geometry
Gridded: If false, returns 1D coordinates
- flatbool,
optional Whether to flatten array.
- dimension
- Returns:
np.ndarrayArray of values along the requested dimension.
- class holoviews.element.annotation.VSpans(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
VectorizedAnnotationParameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, vdimsholoviews.core.element.Element2D: extentsholoviews.core.data.Dataset: datatypegroup = 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]#
-
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData: labelholoviews.core.dimension.Dimensioned: cdims, kdims, vdimsholoviews.core.element.Element2D: extentsholoviews.core.data.Dataset: group, datatype