Overlaying overlays looses previously applied options

Overlaying curves preserves options

c1 = hv.Curve(np.random.rand(10)).opts(width=500)
c2 = hv.Curve(np.random.rand(10))
d = c1*c2
print(d)
d

Yet, if I try the same with Overlay(s), the width is not preserved:

c1 = hv.Overlay([hv.Curve(np.random.rand(10))]).opts(width=500)
c2 = hv.Curve(np.random.rand(10))
d = c1*c2
print(d)
d

Is this a feature or a bug?

I’m on a Mac, within a Jupyter Notebook, running holoviews 1.15.1, and python 3.9.13.

Ok, I’ve a way around it. Slightly modifying an answer to a related question on github

# retrieving plotting options:
from holoviews import Store
options = Store.lookup_options(Store.current_backend, c1, 'plot')
options.kwargs

output: OrderedDict([('width', 500)])

# apply them to the resulting overlay
d.opts(options)

but, shouldn’t this be the default behavior?

This seems related to this issue.

1 Like