HSpan#

Download this notebook from GitHub (right-click to download).


Title: HSpan Element#

Dependencies: Matplotlib

Backends: Bokeh, Plotly, Matplotlib

import numpy as np
import holoviews as hv
from holoviews import opts

hv.extension('matplotlib')

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:

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(facecolor='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:

(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).

This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.

Download this notebook from GitHub (right-click to download).