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

Layout Container
In [1]:
import numpy as np
import holoviews as hv

A Layout is a collection of HoloViews objects that are related in some way, to be displayed side-by-side. Like Overlay and unlike other containers such as HoloMap , GridSpace and NdLayout a Layout is not dictionary like: it holds potentially heterogeneous types without any dimensioned keys.

A Layout cannot contain NdLayouts but can otherwise contain any other HoloViews object. See Building Composite Objects for more details on how to compose containers. It is best to learn about Layout and Overlay together as they are very closely related objects that share many core concepts.

Layout is a heterogeneous collection

You can build a Layout between any two HoloViews objects (which can have different types) using the + operator:

In [2]:
xvals = [0.1* i for i in range(100)]
curve =  hv.Curve((xvals, [np.sin(x) for x in xvals]))
scatter =  hv.Scatter((xvals[::5], np.linspace(0,1,20)))
curve + scatter

In this example, we have a Layout composed of a Curve element and a Scatter element. The one restriction on what you can put in a Layout is that you cannot combine an NdLayout with a regular Layout.

For more information about both Layout and Overlay, see the Composing_Elements user guide.

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