HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/holoviews/examples/reference/elements/bokeh/Bounds.ipynb
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
    "<dl class=\"dl-horizontal\">\n",
    "  <dt>Title</dt> <dd> Bounds Element</dd>\n",
    "  <dt>Dependencies</dt> <dd>Bokeh</dd>\n",
    "  <dt>Backends</dt>\n",
    "    <dd><a href='./Bounds.ipynb'>Bokeh</a></dd>\n",
    "    <dd><a href='../matplotlib/Bounds.ipynb'>Matplotlib</a></dd>\n",
    "    <dd><a href='../plotly/Bounds.ipynb'>Plotly</a></dd>\n",
    "</dl>\n",
    "</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import holoviews as hv\n",
    "from holoviews import opts\n",
    "hv.extension('bokeh')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A ``Bounds`` element is an box shaped annotation that is specified as a tuple in (left, bottom, right, top) format:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "penguins = hv.RGB.load_image('../assets/penguins.png')\n",
    "(penguins * hv.Bounds((-0.15, -0.4, 0.2, 0))).opts(\n",
    "   opts.Bounds(color='orange', line_width=6))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "It is useful for denoting a region of interest defined by some bounds (such as a slice) which is unlike the [``Box``](./Box.ipynb) 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:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "penguins * penguins[-0.15:0.2, -0.4:0, 'G'] * hv.Bounds((-0.15, -0.4, 0.2, 0))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For full documentation and the available style and plot options, use ``hv.help(hv.Bounds).``"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}