Image#

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


Title
Image Element
Dependencies
Plotly
Backends
Bokeh
Matplotlib
Plotly
import numpy as np
import holoviews as hv
hv.extension('plotly')

Like Raster, a HoloViews Image allows you to view 2D arrays using an arbitrary color map. Unlike Raster, an Image is associated with a 2D coordinate system in continuous space, which is appropriate for values sampled from some underlying continuous distribution (as in a photograph or other measurements from locations in real space).

ls = np.linspace(0, 10, 200)
xx, yy = np.meshgrid(ls, ls)

bounds=(-1,-1,1,1)   # Coordinate system: (left, bottom, right, top)
img = hv.Image(np.sin(xx)*np.cos(yy), bounds=bounds)
img

Slicing, sampling, etc. on an Image all operate in this continuous space, whereas the corresponding operations on a Raster work on the raw array coordinates.

img + img[-0.5:0.5, -0.5:0.5]