diff --git a/holoviews/util.py b/holoviews/util.py index 15ad626db4..215ba043cc 100644 --- a/holoviews/util.py +++ b/holoviews/util.py @@ -74,7 +74,8 @@ def _get_streams(self, map_obj): updates = {k: self.p.operation.p.get(k) for k, v in stream.contents.items() if v is None and k in self.p.operation.p} if updates: - stream.update(**updates) + reverse = {v: k for k, v in stream._rename.items()} + stream.update(**{reverse.get(k, k): v for k, v in updates.items()}) streams.append(stream) if isinstance(map_obj, DynamicMap): dim_streams = util.dimensioned_streams(map_obj) diff --git a/tests/testdynamic.py b/tests/testdynamic.py index d0e39a2caf..1c1131fd8b 100644 --- a/tests/testdynamic.py +++ b/tests/testdynamic.py @@ -4,7 +4,8 @@ from holoviews import Dimension, NdLayout, GridSpace, Layout from holoviews.core.spaces import DynamicMap, HoloMap, Callable from holoviews.element import Image, Scatter, Curve, Text, Points -from holoviews.streams import Stream, PointerXY, PointerX, PointerY +from holoviews.operation import histogram +from holoviews.streams import Stream, PointerXY, PointerX, PointerY, RangeX from holoviews.util import Dynamic from holoviews.element.comparison import ComparisonTestCase @@ -320,6 +321,19 @@ def fn(x, multiplier=2): dmap_with_fn = Dynamic(dmap, operation=fn, kwargs=dict(multiplier=3)) self.assertEqual(dmap_with_fn[5], Image(sine_array(0,5)*3)) + def test_dynamic_operation_init_renamed_stream_params(self): + img = Image(sine_array(0,5)) + stream = RangeX(rename={'x_range': 'bin_range'}) + dmap_with_fn = histogram(img, bin_range=(0, 1), streams=[stream], dynamic=True) + self.assertEqual(stream.x_range, (0, 1)) + + def test_dynamic_operation_init_stream_params(self): + img = Image(sine_array(0,5)) + stream = Stream.define('TestStream', bin_range=None)() + dmap_with_fn = histogram(img, bin_range=(0, 1), streams=[stream], dynamic=True) + self.assertEqual(stream.bin_range, (0, 1)) + + class DynamicTestOverlay(ComparisonTestCase):