Repository: holoviz/holoviews

Issue:
Trying to add marginal histogram to just one axis
I am in need to add a histogram to one axis similar to the question posted in https://discourse.holoviz.org/t/how-to-add-a-histogram-to-just-the-x-axis/133/1

I was trying to reproduce the code recommendation but failing the same as others in the thread. The suggestion was to report it in GitHub but not able to find previous issues.


Discussion:

Resolving patch:
diff --git a/holoviews/core/layout.py b/holoviews/core/layout.py
--- a/holoviews/core/layout.py
+++ b/holoviews/core/layout.py
@@ -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)
 
 
 
diff --git a/holoviews/ipython/display_hooks.py b/holoviews/ipython/display_hooks.py
--- a/holoviews/ipython/display_hooks.py
+++ b/holoviews/ipython/display_hooks.py
@@ -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
@@ -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]:
@@ -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)
diff --git a/holoviews/plotting/plot.py b/holoviews/plotting/plot.py
--- a/holoviews/plotting/plot.py
+++ b/holoviews/plotting/plot.py
@@ -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):


Test patch:
diff --git a/holoviews/tests/plotting/bokeh/test_layoutplot.py b/holoviews/tests/plotting/bokeh/test_layoutplot.py
--- a/holoviews/tests/plotting/bokeh/test_layoutplot.py
+++ b/holoviews/tests/plotting/bokeh/test_layoutplot.py
@@ -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)