Title: HSpan Element

Dependencies: Bokeh

Backends: Matplotlib, Plotly, Bokeh

In [ ]:
import numpy as np
import holoviews as hv
from holoviews import opts

hv.extension('bokeh')

The HSpan element is a type of annotation that marks a range along the y-axis. Here is an HSpan element that marks the standard deviation in a collection of points:

In [ ]:
xs = np.random.normal(size=500)
ys = np.random.normal(size=500) * xs
ymean, ystd = ys.mean(), ys.std()

points = hv.Points((xs,ys))
hspan  = hv.HSpan(ymean-ystd, ymean+ystd)

hspan.opts(color='blue') * points.opts(color='#D3D3D3')

Like all annotation-like elements HSpan is not included in the calculation of axis ranges by default, but can be included by setting apply_ranges=True:

In [ ]:
(hv.HSpan(1, 3) * hv.HSpan(5, 8)).opts(
    opts.HSpan(apply_ranges=True))

For full documentation and the available style and plot options, use hv.help(hv.HSpan).