#### Title: VSpan Element¶

Dependencies: Matplotlib

Backends: Bokeh, Plotly, Matplotlib

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

hv.extension('matplotlib')


The VSpan element is a type of annotation that marks a range along the x-axis. Here is a VSpan marking maximum region of a quadratic curve:

In [ ]:
xs = np.linspace(-5, 5, 100)
ys = -(xs-2)**2
ymax = ys.argmax()

curve = hv.Curve((xs,ys))
vspan = hv.VSpan(xs[ymax-5], xs[ymax+5])

curve.opts(color='#D3D3D3') * vspan.opts(facecolor='red')


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

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


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