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/plotly/Bounds.ipynb
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### **Title**: Bounds Element\n",
    "\n",
    "**Dependencies**: Plotly\n",
    "\n",
    "**Backends**: [Bokeh](../bokeh/Bounds.ipynb), [Matplotlib](../matplotlib/Bounds.ipynb), [Plotly](./Bounds.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import holoviews as hv\n",
    "from holoviews import opts\n",
    "hv.extension('plotly')"
   ]
  },
  {
   "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(line_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": 4
}