Bounds

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


Title: Bounds Element

Dependencies: Plotly

Backends: Bokeh, Matplotlib, Plotly

In [1]:
import holoviews as hv
from holoviews import opts
hv.extension('plotly')

A Bounds element is an box shaped annotation that is specified as a tuple in (left, bottom, right, top) format:

In [2]:
penguins = hv.RGB.load_image('../assets/penguins.png')
(penguins * hv.Bounds((-0.15, -0.4, 0.2, 0))).opts(
   opts.Bounds(line_color='orange', line_width=6))
Out[2]:

It is useful for denoting a region of interest defined by some bounds (such as a slice) which is unlike the Box element which is useful for drawing a box at a specific location. Here we show the a slice of the RGB element (green channel only) outlined by the bounds. Note that the values in the Bounds tuple are the same ones as used in the slice:

In [3]:
penguins * penguins[-0.15:0.2, -0.4:0, 'G'] * hv.Bounds((-0.15, -0.4, 0.2, 0))
Out[3]:

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


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