I tried to play with your example. I get another error than the one you refer to above. I get
AssertionError: DynamicMap must only contain one type of object, not both NoneType and VLine.
So for your example I believe you need to return a
VLine from the dynamic map always.
A Hack could be to return a VLine with some x outside the visible x-range.
import holoviews as hv
curve = hv.Curve(range(0, 10))
tap = hv.streams.Tap(x=0, y=0, source=curve)
def conditional_line(x, y):
if x >= 0 and x <= 5:
dmap = hv.DynamicMap(conditional_line, streams=[tap])
curve * dmap
Your use case of returning different
types in the
DynamicMap seems reasonable to me, so you could try to open a feature request on GitHub.
Thanks for providing the minimum code example. It’s the best way to get help and also help shape a code base of examples by and for the community. I’m also just a user and I learned something from your code example I can use in my work one day.
If this answer solves your problem please mark it as a solution.
And welcome to the community by the way