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

Do not attach stream subscribers to batched ElementPlot #1301

Merged
merged 2 commits into from
Apr 17, 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
3 changes: 2 additions & 1 deletion holoviews/plotting/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,8 @@ def __init__(self, element, keys=None, ranges=None, dimensions=None,
self.comm = self.init_comm()
self.traverse(lambda x: setattr(x, 'comm', self.comm))

if not self.overlaid:
# Attach streams if not overlaid and not a batched ElementPlot
if not (self.overlaid or (self.batched and not isinstance(self, GenericOverlayPlot))):
attach_streams(self, self.hmap)

# Update plot and style options for batched plots
Expand Down
11 changes: 11 additions & 0 deletions tests/testplotinstantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,17 @@ def test_batched_spike_plot(self):
extents = plot.get_extents(overlay, {})
self.assertEqual(extents, (0, 0, 9, 1))

def test_batched_curve_subscribers_correctly_attached(self):
posx = PositionX()
opts = {'NdOverlay': dict(plot=dict(legend_limit=0)),
'Curve': dict(style=dict(line_color=Cycle(values=['red', 'blue'])))}
overlay = DynamicMap(lambda x: NdOverlay({i: Curve([(i, j) for j in range(2)])
for i in range(2)})(opts), kdims=[],
streams=[posx])
plot = bokeh_renderer.get_plot(overlay)
self.assertIn(plot.refresh, posx.subscribers)
self.assertNotIn(list(plot.subplots.values())[0].refresh, posx.subscribers)

def test_batched_points_size_and_color(self):
opts = {'NdOverlay': dict(plot=dict(legend_limit=0)),
'Points': dict(style=dict(size=Cycle(values=[1, 2])))}
Expand Down