VSpan#

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


Title: VSpan Element#

Dependencies: Plotly

Backends: Bokeh, Matplotlib, Plotly

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

hv.extension('plotly')

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:

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

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

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