{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "
\n", "
Title
Bounds Element
\n", "
Dependencies
Bokeh
\n", "
Backends
\n", "
Bokeh
\n", "
Matplotlib
\n", "
Plotly
\n", "
\n", "
" ] }, { "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 }