Markers in multiline graph

I have successfully created a multiline plot in bokeh with the colors for the lines as I want. I also correctly insert a legend by using the legend_field argument to the Multiline constructor. On the graph though, to better show the location of the points, I also add a scatter plot with, again, chosen markers of the same color as the line.

The problem is that, correctly, the legend that is produced does not contain the markers on the line, but just the line color.

How can I add the markers in the legend? I have seen this solution Bokeh: How to show both color and marker type in legend - Stack Overflow that builds a list of pairs of colors and markers and then builds a custom legend object.

But I have seen there is a decorations argument in Multiline constructor MultiLine — Bokeh 3.5.0 Documentation which I think can give me what I want without the hassle of building the legend myself. However, I have not found any example of Multiline that uses that so I am not sure how best create the list of decorations.

Any help?

Thanks a lot,

Just to specify better…

The Multiline object is ideal for me because I am not sure how many lines I have rather than having a dictionary of line objects which need updating every time the selection changes. It’s doable, I just thought markers are something somebody wants to add to a line.


I’m not sure of the status of this, but has been discussed here → [FEATURE] MultiScatter · Issue #12367 · bokeh/bokeh · GitHub

1 Like