Skip to content

Commit

Permalink
Allow None in keys for partial dimension overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Aug 24, 2016
1 parent 35d9d93 commit 5da84f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion holoviews/core/ndmapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _add_item(self, dim_vals, data, sort=True, update=True):
if not self._instantiated and self.get_dimension(dim).values == 'initial':
if val not in vals:
self._cached_index_values[dim.name].append(val)
elif vals and val not in vals:
elif vals and val is not None and val not in vals:
raise KeyError('%s dimension value %s not in'
' specified dimension values.' % (dim, repr(val)))

Expand Down
1 change: 1 addition & 0 deletions holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ def dimension_sort(odict, kdims, vdims, categorical, key_index, cached_values):
indexes = [(dimensions[i], int(i not in range(ndims)),
i if i in range(ndims) else i-ndims)
for i in key_index]
cached_values = {d: [None]+vals for d, vals in cached_values.items()}

if len(set(key_index)) != len(key_index):
raise ValueError("Cannot sort on duplicated dimensions")
Expand Down
10 changes: 10 additions & 0 deletions tests/testplotinstantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ def test_dynamic_nonoverlap(self):
dmap2 = DynamicMap(lambda x: Curve(np.random.rand(10,2))*VLine(x),
kdims=kdims[:1])
renderer.get_widget(dmap1 + dmap2, 'selection')


def test_dynamic_values_partial_overlap(self):
kdims = [Dimension('File', range=(0.01, 1)),
Dimension('SliceDimension', values=['x', 'y', 'z']),
Dimension('Coordinates', range=(0.01, 1))]
dmap1 = DynamicMap(lambda x, y, z: Image(np.random.rand(10,10)), kdims=kdims)
dmap2 = DynamicMap(lambda x: Curve(np.random.rand(10,2))*VLine(x),
kdims=kdims[:1])
renderer.get_widget(dmap1 + dmap2, 'selection')

0 comments on commit 5da84f9

Please sign in to comment.