The HoloMap is a core HoloViews data structure that allows easy exploration of parameter spaces. The essence of a HoloMap is that it contains a collection of Elements (e.g.
Curves) that you can easily select and visualize.
HoloMaps hold fully constructed Elements at specifically sampled points in a multidimensional space. Although HoloMaps are useful for exploring high-dimensional parameter spaces, they can very quickly consume huge amounts of memory to store all these Elements. For instance, a hundred samples along four orthogonal dimensions would need a HoloMap containing a hundred million Elements, each of which could be a substantial object that takes time to create and costs memory to store. Thus
HoloMaps have some clear limitations:
HoloMaps may require the generation of millions of Elements before the first element can be viewed.
HoloMaps can easily exhaust all the memory available to Python.
HoloMaps can even more easily exhaust all the memory in the browser when displayed.
Static export of a notebook containing HoloMaps can result in impractically large HTML files.
DynamicMap addresses these issues by computing and displaying elements dynamically, allowing exploration of much larger datasets:
DynamicMaps generate elements on the fly, allowing the process of exploration to begin immediately.
DynamicMaps do not require fixed sampling, allowing exploration of parameters with arbitrary resolution.
DynamicMaps are lazy in the sense they only compute as much data as the user wishes to explore.
Of course, these advantages come with some limitations:
DynamicMaps require a live notebook server and cannot be fully exported to static HTML.
DynamicMaps store only a portion of the underlying data, in the form of an Element cache and their output is dependent on the particular version of the executed code.
DynamicMaps (and particularly their element caches) are typically stateful (with values that depend on patterns of user interaction), which can make them more difficult to reason about.
In addition to the different computational requirements of
DynamicMaps, they can be used to build sophisticated, interactive vizualisations that cannot be achieved using only
HoloMaps. This notebook demonstrates some basic examples and the Responding to Events guide follows on by introducing the streams system. The Custom Interactivity shows how you can directly interact with your plots when using the Bokeh backend.
When DynamicMap was introduced in version 1.6, it supported multiple different ‘modes’ which have now been deprecated. This notebook demonstrates the simpler, more flexible and more powerful DynamicMap introduced in version 1.7. Users who have been using the previous version of DynamicMap should be unaffected as backwards compatibility has been preserved for the most common cases.
All this will make much more sense once we’ve tried out some
DynamicMaps and showed how they work, so let’s create one!
When viewing this user guide as part of the documentation DynamicMaps will be sampled with a limited number of states.
It's also best to run this notebook one cell at a time, not via "Run All",
so that subsequent cells can reflect your dynamic interaction with widgets in previous cells.
Let’s start by importing HoloViews and loading the extension:
import numpy as np import holoviews as hv from holoviews import opts hv.extension('matplotlib')