Indexing and Selecting Data ¶
As explained in the Building composite objects and Dimensioned Containers guides, HoloViews allows you to build up hierarchical containers that express the natural relationships between your data items, in whatever multidimensional space best characterizes your application domain. Once your data is in such containers, individual visualizations are then made by choosing subregions of this multidimensional space, either smaller numeric ranges (as in cropping of photographic images), or lower-dimensional subsets (as in selecting frames from a movie, or a specific movie from a large library), or both (as in selecting a cropped version of a frame from a specific movie from a large library).
In this tutorial, we show how to specify such selections, using five different (but related) operations that can act on an element
|indexing||e[5.5], e[3,5.5]||Selecting a single data value, returning one actual numerical value from the existing data|
|slice||e[3:5.5], e[3:5.5,0:1]||Selecting a contiguous portion from an Element, returning the same type of Element|
|Selecting one or more regularly spaced data values, returning a new type of Element|
|More verbose notation covering all supporting slice and index operations by dimension name.|
|Indexes and slices by row and column tabular index supporting integer indexes, slices, lists and boolean indices.|
These operations are all concerned with selecting some subset of your data values, without combining across data values (e.g. averaging) or otherwise transforming your actual data. In the Tabular Data tutorial we will look at other operations on the data that reduce, summarize, or transform the data in other ways, rather than selections as covered here.
We'll be going through each operation in detail and provide a visual illustration to help make the semantics of each operation clear. This Tutorial assumes that you are familiar with continuous and discrete coordinate systems, so please review our Continuous Coordinates guide if you have not done so already.
import numpy as np import holoviews as hv hv.extension('bokeh', 'matplotlib')