Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow None in keys for partial dimension overlap #830

Merged
merged 2 commits into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion holoviews/core/ndmapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,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 @@ -645,6 +645,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
8 changes: 8 additions & 0 deletions tests/testplotinstantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ def test_dynamic_nonoverlap(self):
kdims=kdims[:1])
mpl_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])
mpl_renderer.get_widget(dmap1 + dmap2, 'selection')

def test_dynamic_streams_refresh(self):
stream = PositionXY()
Expand Down