Histogram, `mul` operators works, Overlay fails

Hello,

I can get the * operator to work for histograms but not Overlay (see below). Does anyone know why? I’d expect both to work or both to break.

Thanks,

Douglas

import holoviews as hv
import numpy as np

points_1 = hv.Points(np.random.randn(100,2))
points_2 = hv.Points(np.random.randn(100,2))

list_hist = [points_1.hist(dimension=['x','y']), 
         points_2.hist(dimension=['x','y'])]


# Running in Jupyter this works
list_hist[0] * list_hist[1]


# However this breaks
hv.Overlay(list_hist)

# TypeError: __init__() missing 2 required positional arguments: 'layout_type' and 'subplots'

Generally issues like this occur when containers are not nested in a way that HoloViews expects. In this particular case you are not combining a list of histograms but a list of so called AdjointLayout objects which are Points with the histograms adjoined to them. Ordinarily it would try to reorganize this automatically but it seems in this case that fails. You can however trigger that manually by doing:

hv.Overlay(list_hist).collate()

An issue to handle this automatically would be appreciated.

1 Like

Thank you, for replying so quickly. Will test your solution and raise and issue.

Hope you are are safe and well.

Kind regards,

Douglas