Line Graph Combine With Scatter?

Question:
Is it possible to use scatter and line plots on the same graph?
Currently we are using glyphs, but after about 200 glyphs, it really starts to slow down the loading process.
I realized we could replace the glyphs with scatter points, but I have not been able to find any documentation about this.

Thanks!

Hi @magicapples

I’m not quite sure I understand the situation. If you have 200 glyphs on a plot, you are already combining things on the same graph, and combining a line and a scatter on the same graph is no different, i.e. you plot a line, and then you plot a scatter on top:

https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html#combining-multiple-glyphs

I guess it would help to understand what you are doing now, because I can’t really picture what’s going on by the description.

Thanks for the response.
Maybe I misunderstand what glyphs are relative to scatter.
scatter%20vs%20glyphs

We have some data that we plot with a line. then we have some accompanying data we are representing using glyphs.
I can plot 500,000 data points using continuous line plot in about 30 seconds.
But as soon as I add 200 scatter points using glyphs, now it takes 5 minutes to load the graph.

I think these should just be another 200 points of data. It doesn’t make sens they take that extra time to load.
So I think we are misusing glyphs, and really, these should just be scatter points of data.

@magicapples I think this discussion would be greatly clarified with some sample code. For example, I can’t tell if you are making one call to circle with data to plot 200 circles, or if you are trying to make 200 calls to circle to plot one circle each. The former is the correct and should be fine. The latter is probably not (Bokeh is optimized to work well with a few glyphs that potentially have many points, not with very many glyphs that each have few points.)

This it seems was the solution.
We were using 200 calls to plot one circle each.
We have since tested this on a new plot and it is working.
We will eventually get over to repairing the previous graph and I will update if this was exact solution.

Thank you very much for the response!

1 Like