Adding glyphs through hooks

Hello,

I am trying to use a hook to add more lines based on another variable. The add_glyph seems to work correctly as I get 2 renderers. However, they are not shown in the plot.

How can I make it visible?

import holoviews as hv
from holoviews import opts, streams
from bokeh.models import Line, ColumnDataSource
hv.extension("bokeh")
def add_time_series(plot, element):

    source = ColumnDataSource(dict(x=[1,2,3,4], y=[5,5,5,5]))
    line = Line(x="date", y="y")
    plot.state.add_glyph(source, line)
    
    assert len(plot.state.renderers) == 2

hv.Curve([1,1,1,1]).opts(hooks=[add_time_series], framewise=True)

Why don’t you combine two curves?

hv.Curve([1,1,1,1]) * hv.Curve(([1,2,3,4], [5,5,5,5]))

image

So this is in the context of a broader task. We are using datashader and we have a tile map and a Dynamic Map that controls the stream. There seems to be an issue when combining the three as I posted here Tap Selection.

Doing what you suggested would give me an hv.Overlay.

What I am hoping to do is add to a plot using hook as a workaround? Is that possible? As stated above, it seems to work as they are added to the figure but they are not shown.