From b5772cc0b134f40369cba7db753d2f8d06a4995f Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Wed, 31 Aug 2016 21:17:22 +0100 Subject: [PATCH] Allowed NdMappings with no kdims --- holoviews/core/ndmapping.py | 2 ++ holoviews/core/util.py | 4 +++- holoviews/plotting/renderer.py | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/holoviews/core/ndmapping.py b/holoviews/core/ndmapping.py index de573b6557..1936b4ca17 100644 --- a/holoviews/core/ndmapping.py +++ b/holoviews/core/ndmapping.py @@ -573,6 +573,8 @@ def __getitem__(self, indexslice): raise IndexError("Boolean index must match length of sliced object") selection = zip(indexslice, self.data.items()) return self.clone([item for c, item in selection if c]) + elif indexslice == () and not self.kdims: + return self.data[()] elif indexslice in [Ellipsis, ()]: return self elif Ellipsis in wrap_tuple(indexslice): diff --git a/holoviews/core/util.py b/holoviews/core/util.py index 13c0d44324..ce99c8832e 100644 --- a/holoviews/core/util.py +++ b/holoviews/core/util.py @@ -888,7 +888,9 @@ def get_dynamic_item(map_obj, dimensions, key): and a corresponding key. The dimensions must be a subset of the map_obj key dimensions. """ - if isinstance(key, tuple): + if key == () and not dimensions: + return key, map_obj[()] + elif isinstance(key, tuple): dims = {d.name: k for d, k in zip(dimensions, key) if d in map_obj.kdims} key = tuple(dims.get(d.name) for d in map_obj.kdims) diff --git a/holoviews/plotting/renderer.py b/holoviews/plotting/renderer.py index 4104ee3d2a..b2e9884e44 100644 --- a/holoviews/plotting/renderer.py +++ b/holoviews/plotting/renderer.py @@ -202,7 +202,8 @@ def _validate(self, obj, fmt): if fmt in ['auto', None]: if ((len(plot) == 1 and not plot.dynamic) - or (len(plot) > 1 and self.holomap is None)): + or (len(plot) > 1 and self.holomap is None) or + (plot.dynamic and len(plot.keys[0]) == 0)): fmt = fig_formats[0] if self.fig=='auto' else self.fig else: fmt = holomap_formats[0] if self.holomap=='auto' else self.holomap