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

Fix hv.Empty not working in AdjointLayout plot #5584

Merged
merged 4 commits into from Jan 11, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions holoviews/core/layout.py
Expand Up @@ -62,8 +62,8 @@ class Empty(Dimensioned, Composable):

group = param.String(default='Empty')

def __init__(self):
super().__init__(None)
def __init__(self, **params):
super().__init__(None, **params)



Expand Down
6 changes: 4 additions & 2 deletions holoviews/ipython/display_hooks.py
Expand Up @@ -15,7 +15,7 @@
AbbreviatedException)
from ..core import (
ViewableElement, HoloMap, AdjointLayout, NdLayout, GridSpace,
Layout, CompositeOverlay, DynamicMap, Dimensioned
Layout, CompositeOverlay, DynamicMap, Dimensioned, Empty
)
from ..core.traversal import unique_dimkeys
from ..core.io import FileArchive
Expand Down Expand Up @@ -178,7 +178,7 @@ def element_display(element, max_frames):
info = process_object(element)
if info:
display(HTML(info))
return
return None

backend = Store.current_backend
if type(element) not in Store.registry[backend]:
Expand Down Expand Up @@ -253,6 +253,8 @@ def display(obj, raw_output=False, **kwargs):
output = map_display(obj)
elif isinstance(obj, Plot):
output = render(obj)
elif isinstance(obj, Empty):
output = ({}, {})
else:
output = obj
raw = kwargs.pop('raw', False)
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/plot.py
Expand Up @@ -138,7 +138,7 @@ def pane(self, pane):
for plot in self.subplots.values():
if plot is not None:
plot.pane = pane
if not plot.root:
if plot is None or not plot.root:
continue
for cb in getattr(plot, 'callbacks', []):
if hasattr(pane, '_on_error') and getattr(cb, 'comm', None):
Expand Down
8 changes: 8 additions & 0 deletions holoviews/tests/plotting/bokeh/test_layoutplot.py
Expand Up @@ -228,6 +228,14 @@ def test_empty_adjoint_plot(self):
self.assertEqual(s1.height, 0)
self.assertEqual(f1.plot_height, f2.plot_height)

def test_empty_adjoint_plot_with_renderer(self):
# https://github.com/holoviz/holoviews/pull/5584
scatter = Scatter(range(10))
adjoin_layout_plot = scatter << Empty() << scatter.hist(adjoin=False)

# To render the plot
bokeh_renderer(adjoin_layout_plot)

def test_layout_plot_with_adjoints(self):
layout = (Curve([]) + Curve([]).hist()).cols(1)
plot = bokeh_renderer.get_plot(layout)
Expand Down