Bokeh server really slow to render

Hello, I am trying to build a bokeh dashboard and am currently stuck on my first tab.

image.png

The plot seen above renders just fine in my jupyter notebook (taking about a second). However, when I stick the same code (roughly) in a bokeh server, it is unbearably slow (multiple minutes).

I am making a lineplot with many lines, and a lot of them overlap (could be causing a rendering issue?)

I have grouped all these lines into 7 lines in total (as I have read it is better to draw fewer larger lines than more small ones).

A shortened example of the data looks like this:

xs = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,

np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192, 12.02739726, 13.25205479, 14.22739726,np.nan,np.nan,np.nan, 6.55616438, 7.53150685, 8.52054795,

9.47123288, 10.44109589,np.nan]),

np.array([np.nan,np.nan,np.nan, 0.70410959, 1.63835616,

2.73972603, 3.64931507,np.nan,np.nan,np.nan,np.nan, 4.00821918, 5.04383562, 6.00821918, 7.05479452,

np.nan,np.nan,np.nan,np.nan, 4.56164384,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192,np.nan,np.nan,np.nan,np.nan,np.nan, 5.94794521, 6.55616438, 7.53150685, 8.52054795,

np.nan,np.nan,np.nan])]

ys = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([ np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

-0.15652901, 0.14953203, 0.62195036, 0.64414847, np.nan,

np.nan, np.nan, -0.33739475, -0.27092199, -0.32020045,

-0.35019554, -0.21857558, np.nan]),

np.array([ np.nan, np.nan, np.nan, -0.42062806, -0.50175937,

-0.39375614, -0.45259168, np.nan, np.nan, np.nan,

np.nan, -0.38755729, -0.45590074, -0.38985249, -0.30375873,

np.nan, np.nan, np.nan, np.nan, -0.10799712,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

-0.15652901, np.nan, np.nan, np.nan, np.nan,

np.nan, -0.2219407 , -0.33739475, -0.27092199, -0.32020045,

np.nan, np.nan, np.nan])]

single_sources = [ColumnDataSource({‘x_line’: xs[i], ‘y_line’: ys[i]}) for i in range(7)]

``

As you can see the data contains a lot of nans, could this be the problem?

Finally I plot like this:

f = figure(toolbar_location=None, title=‘Planjaar alle wegen’)
f.xaxis.axis_label=‘Leeftijd’

f.yaxis.axis_label=‘PCA_1’

for i,col,lbl in zip(range(7),colors_pljr,labels):

r = f.line(x=‘x_line’, y=‘y_line’, alpha=0.5, line_width=2, source=single_sources[i], line_color=col, legend=lbl)

f.legend.location = “top_left”

f.legend.click_policy=“hide”

``

NOTE: this example actually plots just fine, it is only when I try to make the full 40,000+ line plot that the rendering becomes unbearably long (multiple minutes).

I have also added a CheckboxGroup. In the full plot it again can take a minute or more before the callback is actually called.

Could anybody point out what I am missing?

It was the huge number of NaN’s

···

Op dinsdag 11 september 2018 14:44:47 UTC+2 schreef Laurens Hagendoorn:

Hello, I am trying to build a bokeh dashboard and am currently stuck on my first tab.

The plot seen above renders just fine in my jupyter notebook (taking about a second). However, when I stick the same code (roughly) in a bokeh server, it is unbearably slow (multiple minutes).

I am making a lineplot with many lines, and a lot of them overlap (could be causing a rendering issue?)

I have grouped all these lines into 7 lines in total (as I have read it is better to draw fewer larger lines than more small ones).

A shortened example of the data looks like this:

xs = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,

np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192, 12.02739726, 13.25205479, 14.22739726,np.nan,np.nan,np.nan, 6.55616438, 7.53150685, 8.52054795,

9.47123288, 10.44109589,np.nan]),

np.array([np.nan,np.nan,np.nan, 0.70410959, 1.63835616,

2.73972603, 3.64931507,np.nan,np.nan,np.nan,np.nan, 4.00821918, 5.04383562, 6.00821918, 7.05479452,

np.nan,np.nan,np.nan,np.nan, 4.56164384,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192,np.nan,np.nan,np.nan,np.nan,np.nan, 5.94794521, 6.55616438, 7.53150685, 8.52054795,

np.nan,np.nan,np.nan])]

ys = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),

np.array([ np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

-0.15652901, 0.14953203, 0.62195036, 0.64414847, np.nan,

np.nan, np.nan, -0.33739475, -0.27092199, -0.32020045,

-0.35019554, -0.21857558, np.nan]),

np.array([ np.nan, np.nan, np.nan, -0.42062806, -0.50175937,

-0.39375614, -0.45259168, np.nan, np.nan, np.nan,

np.nan, -0.38755729, -0.45590074, -0.38985249, -0.30375873,

np.nan, np.nan, np.nan, np.nan, -0.10799712,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

np.nan, np.nan, np.nan, np.nan, np.nan,

-0.15652901, np.nan, np.nan, np.nan, np.nan,

np.nan, -0.2219407 , -0.33739475, -0.27092199, -0.32020045,

np.nan, np.nan, np.nan])]

single_sources = [ColumnDataSource({‘x_line’: xs[i], ‘y_line’: ys[i]}) for i in range(7)]

``

As you can see the data contains a lot of nans, could this be the problem?

Finally I plot like this:

f = figure(toolbar_location=None, title=‘Planjaar alle wegen’)
f.xaxis.axis_label=‘Leeftijd’

f.yaxis.axis_label=‘PCA_1’

for i,col,lbl in zip(range(7),colors_pljr,labels):

r = f.line(x=‘x_line’, y=‘y_line’, alpha=0.5, line_width=2, source=single_sources[i], line_color=col, legend=lbl)

f.legend.location = “top_left”

f.legend.click_policy=“hide”

``

NOTE: this example actually plots just fine, it is only when I try to make the full 40,000+ line plot that the rendering becomes unbearably long (multiple minutes).

I have also added a CheckboxGroup. In the full plot it again can take a minute or more before the callback is actually called.

Could anybody point out what I am missing?

There's lots potentially going and intersecting here.

7*40k = 250k points is approach the limits of standard Bokeh canvas rendering, just with simple scatter markers. However lines are more complicated for browser canvases to composite, and they can be wildly inconsistent in their rendering performance, which is outside our control. You might find this is terrible on some browsers, but works fine on others.

Putting NaNs in lines also results in a more complicated code path in Bokeh itself. When the capability to handle NaNs in line was added, nothing like the data below was envisioned. NaN was chosen and intended (perhaps poorly) as a sentinel value signify conceptually single lines that had multiple disjoint segments. I definitelh only had in mind the case "lots of data with a couple of nans in between" As an example I actually have no idea what consecutive NaNs will do or how they will perform.

It's also potentially possible that something about your code organization is preventing Bokeh form using binary array transport. It would require investigation. But TLDR, the JSON spec itself does not support NaN values at all. Thing "kind of work" by accident because JS is terrible about implicit casting, and will convert a string like "nan" to null when treated as a number. But it can be a severe drag on performance. If Bokeh is falling b back to naive JSON encoding then that could also be an issue.

As an aside, I'd really suggest looking at Datashader (together with Bokeh). Datashader renderings things in Python, and can send the resulting images to Bokeh, even in interactive contexts. Aside from implicitly being a technique for bandwidth compression when you have lots of points, Datashader gives you very fine control over rendering which can be very useful for improving the efficacy of visualization when there is extreme over-plotting, such as you seem to have.

Thanks,

Bryan

···

On Sep 11, 2018, at 06:08, [email protected] wrote:
in
It was the huge number of NaN's

Op dinsdag 11 september 2018 14:44:47 UTC+2 schreef Laurens Hagendoorn:
Hello, I am trying to build a bokeh dashboard and am currently stuck on my first tab.

The plot seen above renders just fine in my jupyter notebook (taking about a second). However, when I stick the same code (roughly) in a bokeh server, it is unbearably slow (multiple minutes).

I am making a lineplot with many lines, and a lot of them overlap (could be causing a rendering issue?)
I have grouped all these lines into 7 lines in total (as I have read it is better to draw fewer larger lines than more small ones).

A shortened example of the data looks like this:

xs = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([np.nan, np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,
               np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192, 12.02739726, 13.25205479, 14.22739726,np.nan,np.nan,np.nan, 6.55616438, 7.53150685, 8.52054795,
             9.47123288, 10.44109589,np.nan]),
    np.array([np.nan,np.nan,np.nan, 0.70410959, 1.63835616,
             2.73972603, 3.64931507,np.nan,np.nan,np.nan,np.nan, 4.00821918, 5.04383562, 6.00821918, 7.05479452,
            np.nan,np.nan,np.nan,np.nan, 4.56164384,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192,np.nan,np.nan,np.nan,np.nan,np.nan, 5.94794521, 6.55616438, 7.53150685, 8.52054795,
            np.nan,np.nan,np.nan])]

ys = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
            np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
     np.array([ np.nan, np.nan, np.nan, np.nan, np.nan,
                    np.nan, np.nan, np.nan, np.nan, np.nan,
                    np.nan, np.nan, np.nan, np.nan, np.nan,
                    np.nan, np.nan, np.nan, np.nan, np.nan,
                    np.nan, np.nan, np.nan, np.nan, np.nan,
                    np.nan, np.nan, np.nan, np.nan, np.nan,
                    np.nan, np.nan, np.nan, np.nan, np.nan,
            -0.15652901, 0.14953203, 0.62195036, 0.64414847, np.nan,
                    np.nan, np.nan, -0.33739475, -0.27092199, -0.32020045,
            -0.35019554, -0.21857558, np.nan]),
     np.array([ np.nan, np.nan, np.nan, -0.42062806, -0.50175937,
            -0.39375614, -0.45259168, np.nan, np.nan, np.nan,
                    np.nan, -0.38755729, -0.45590074, -0.38985249, -0.30375873,
                    np.nan, np.nan, np.nan, np.nan, -0.10799712,
                    np.nan, np.nan, np.nan, np.nan, np.nan,
                    np.nan, np.nan, np.nan, np.nan, np.nan,
                    np.nan, np.nan, np.nan, np.nan, np.nan,
            -0.15652901, np.nan, np.nan, np.nan, np.nan,
                    np.nan, -0.2219407 , -0.33739475, -0.27092199, -0.32020045,
                    np.nan, np.nan, np.nan])]

single_sources = [ColumnDataSource({'x_line': xs[i], 'y_line': ys[i]}) for i in range(7)]

As you can see the data contains a lot of nans, could this be the problem?

Finally I plot like this:
f = figure(toolbar_location=None, title='Planjaar alle wegen')
f.xaxis.axis_label='Leeftijd'
f.yaxis.axis_label='PCA_1'
for i,col,lbl in zip(range(7),colors_pljr,labels):
    r = f.line(x='x_line', y='y_line', alpha=0.5, line_width=2, source=single_sources[i], line_color=col, legend=lbl)
f.legend.location = "top_left"
f.legend.click_policy="hide"

NOTE: this example actually plots just fine, it is only when I try to make the full 40,000+ line plot that the rendering becomes unbearably long (multiple minutes).

I have also added a CheckboxGroup. In the full plot it again can take a minute or more before the callback is actually called.

Could anybody point out what I am missing?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/07b8e331-800a-4f94-8def-09ecb72f5790%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Here is a data shader section specifically regarding lines/timeseries:

  http://datashader.org/user_guide/3_Timeseries.html

Bryan

···

On Sep 11, 2018, at 08:05, Bryan Van de ven <[email protected]> wrote:

There's lots potentially going and intersecting here.

7*40k = 250k points is approach the limits of standard Bokeh canvas rendering, just with simple scatter markers. However lines are more complicated for browser canvases to composite, and they can be wildly inconsistent in their rendering performance, which is outside our control. You might find this is terrible on some browsers, but works fine on others.

Putting NaNs in lines also results in a more complicated code path in Bokeh itself. When the capability to handle NaNs in line was added, nothing like the data below was envisioned. NaN was chosen and intended (perhaps poorly) as a sentinel value signify conceptually single lines that had multiple disjoint segments. I definitelh only had in mind the case "lots of data with a couple of nans in between" As an example I actually have no idea what consecutive NaNs will do or how they will perform.

It's also potentially possible that something about your code organization is preventing Bokeh form using binary array transport. It would require investigation. But TLDR, the JSON spec itself does not support NaN values at all. Thing "kind of work" by accident because JS is terrible about implicit casting, and will convert a string like "nan" to null when treated as a number. But it can be a severe drag on performance. If Bokeh is falling b back to naive JSON encoding then that could also be an issue.

As an aside, I'd really suggest looking at Datashader (together with Bokeh). Datashader renderings things in Python, and can send the resulting images to Bokeh, even in interactive contexts. Aside from implicitly being a technique for bandwidth compression when you have lots of points, Datashader gives you very fine control over rendering which can be very useful for improving the efficacy of visualization when there is extreme over-plotting, such as you seem to have.

Thanks,

Bryan

On Sep 11, 2018, at 06:08, [email protected] wrote:
in
It was the huge number of NaN's

Op dinsdag 11 september 2018 14:44:47 UTC+2 schreef Laurens Hagendoorn:
Hello, I am trying to build a bokeh dashboard and am currently stuck on my first tab.

The plot seen above renders just fine in my jupyter notebook (taking about a second). However, when I stick the same code (roughly) in a bokeh server, it is unbearably slow (multiple minutes).

I am making a lineplot with many lines, and a lot of them overlap (could be causing a rendering issue?)
I have grouped all these lines into 7 lines in total (as I have read it is better to draw fewer larger lines than more small ones).

A shortened example of the data looks like this:

xs = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([np.nan, np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,
              np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192, 12.02739726, 13.25205479, 14.22739726,np.nan,np.nan,np.nan, 6.55616438, 7.53150685, 8.52054795,
            9.47123288, 10.44109589,np.nan]),
   np.array([np.nan,np.nan,np.nan, 0.70410959, 1.63835616,
            2.73972603, 3.64931507,np.nan,np.nan,np.nan,np.nan, 4.00821918, 5.04383562, 6.00821918, 7.05479452,
           np.nan,np.nan,np.nan,np.nan, 4.56164384,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192,np.nan,np.nan,np.nan,np.nan,np.nan, 5.94794521, 6.55616438, 7.53150685, 8.52054795,
           np.nan,np.nan,np.nan])]

ys = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
           np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
    np.array([ np.nan, np.nan, np.nan, np.nan, np.nan,
                   np.nan, np.nan, np.nan, np.nan, np.nan,
                   np.nan, np.nan, np.nan, np.nan, np.nan,
                   np.nan, np.nan, np.nan, np.nan, np.nan,
                   np.nan, np.nan, np.nan, np.nan, np.nan,
                   np.nan, np.nan, np.nan, np.nan, np.nan,
                   np.nan, np.nan, np.nan, np.nan, np.nan,
           -0.15652901, 0.14953203, 0.62195036, 0.64414847, np.nan,
                   np.nan, np.nan, -0.33739475, -0.27092199, -0.32020045,
           -0.35019554, -0.21857558, np.nan]),
    np.array([ np.nan, np.nan, np.nan, -0.42062806, -0.50175937,
           -0.39375614, -0.45259168, np.nan, np.nan, np.nan,
                   np.nan, -0.38755729, -0.45590074, -0.38985249, -0.30375873,
                   np.nan, np.nan, np.nan, np.nan, -0.10799712,
                   np.nan, np.nan, np.nan, np.nan, np.nan,
                   np.nan, np.nan, np.nan, np.nan, np.nan,
                   np.nan, np.nan, np.nan, np.nan, np.nan,
           -0.15652901, np.nan, np.nan, np.nan, np.nan,
                   np.nan, -0.2219407 , -0.33739475, -0.27092199, -0.32020045,
                   np.nan, np.nan, np.nan])]

single_sources = [ColumnDataSource({'x_line': xs[i], 'y_line': ys[i]}) for i in range(7)]

As you can see the data contains a lot of nans, could this be the problem?

Finally I plot like this:
f = figure(toolbar_location=None, title='Planjaar alle wegen')
f.xaxis.axis_label='Leeftijd'
f.yaxis.axis_label='PCA_1'
for i,col,lbl in zip(range(7),colors_pljr,labels):
   r = f.line(x='x_line', y='y_line', alpha=0.5, line_width=2, source=single_sources[i], line_color=col, legend=lbl)
f.legend.location = "top_left"
f.legend.click_policy="hide"

NOTE: this example actually plots just fine, it is only when I try to make the full 40,000+ line plot that the rendering becomes unbearably long (multiple minutes).

I have also added a CheckboxGroup. In the full plot it again can take a minute or more before the callback is actually called.

Could anybody point out what I am missing?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/07b8e331-800a-4f94-8def-09ecb72f5790%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

And here is a ref about using Holoviews to drive Datashader+Bokeh together at a high level, for interactive cases:

  http://holoviews.org/user_guide/Large_Data.html

Bryan

···

On Sep 11, 2018, at 08:08, Bryan Van de ven <[email protected]> wrote:

Here is a data shader section specifically regarding lines/timeseries:

  http://datashader.org/user_guide/3_Timeseries.html

Bryan

On Sep 11, 2018, at 08:05, Bryan Van de ven <[email protected]> wrote:

There's lots potentially going and intersecting here.

7*40k = 250k points is approach the limits of standard Bokeh canvas rendering, just with simple scatter markers. However lines are more complicated for browser canvases to composite, and they can be wildly inconsistent in their rendering performance, which is outside our control. You might find this is terrible on some browsers, but works fine on others.

Putting NaNs in lines also results in a more complicated code path in Bokeh itself. When the capability to handle NaNs in line was added, nothing like the data below was envisioned. NaN was chosen and intended (perhaps poorly) as a sentinel value signify conceptually single lines that had multiple disjoint segments. I definitelh only had in mind the case "lots of data with a couple of nans in between" As an example I actually have no idea what consecutive NaNs will do or how they will perform.

It's also potentially possible that something about your code organization is preventing Bokeh form using binary array transport. It would require investigation. But TLDR, the JSON spec itself does not support NaN values at all. Thing "kind of work" by accident because JS is terrible about implicit casting, and will convert a string like "nan" to null when treated as a number. But it can be a severe drag on performance. If Bokeh is falling b back to naive JSON encoding then that could also be an issue.

As an aside, I'd really suggest looking at Datashader (together with Bokeh). Datashader renderings things in Python, and can send the resulting images to Bokeh, even in interactive contexts. Aside from implicitly being a technique for bandwidth compression when you have lots of points, Datashader gives you very fine control over rendering which can be very useful for improving the efficacy of visualization when there is extreme over-plotting, such as you seem to have.

Thanks,

Bryan

On Sep 11, 2018, at 06:08, [email protected] wrote:
in
It was the huge number of NaN's

Op dinsdag 11 september 2018 14:44:47 UTC+2 schreef Laurens Hagendoorn:
Hello, I am trying to build a bokeh dashboard and am currently stuck on my first tab.

The plot seen above renders just fine in my jupyter notebook (taking about a second). However, when I stick the same code (roughly) in a bokeh server, it is unbearably slow (multiple minutes).

I am making a lineplot with many lines, and a lot of them overlap (could be causing a rendering issue?)
I have grouped all these lines into 7 lines in total (as I have read it is better to draw fewer larger lines than more small ones).

A shortened example of the data looks like this:

xs = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([np.nan, np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,
             np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192, 12.02739726, 13.25205479, 14.22739726,np.nan,np.nan,np.nan, 6.55616438, 7.53150685, 8.52054795,
           9.47123288, 10.44109589,np.nan]),
  np.array([np.nan,np.nan,np.nan, 0.70410959, 1.63835616,
           2.73972603, 3.64931507,np.nan,np.nan,np.nan,np.nan, 4.00821918, 5.04383562, 6.00821918, 7.05479452,
          np.nan,np.nan,np.nan,np.nan, 4.56164384,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,11.18082192,np.nan,np.nan,np.nan,np.nan,np.nan, 5.94794521, 6.55616438, 7.53150685, 8.52054795,
          np.nan,np.nan,np.nan])]

ys = [np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan,
          np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]),
   np.array([ np.nan, np.nan, np.nan, np.nan, np.nan,
                  np.nan, np.nan, np.nan, np.nan, np.nan,
                  np.nan, np.nan, np.nan, np.nan, np.nan,
                  np.nan, np.nan, np.nan, np.nan, np.nan,
                  np.nan, np.nan, np.nan, np.nan, np.nan,
                  np.nan, np.nan, np.nan, np.nan, np.nan,
                  np.nan, np.nan, np.nan, np.nan, np.nan,
          -0.15652901, 0.14953203, 0.62195036, 0.64414847, np.nan,
                  np.nan, np.nan, -0.33739475, -0.27092199, -0.32020045,
          -0.35019554, -0.21857558, np.nan]),
   np.array([ np.nan, np.nan, np.nan, -0.42062806, -0.50175937,
          -0.39375614, -0.45259168, np.nan, np.nan, np.nan,
                  np.nan, -0.38755729, -0.45590074, -0.38985249, -0.30375873,
                  np.nan, np.nan, np.nan, np.nan, -0.10799712,
                  np.nan, np.nan, np.nan, np.nan, np.nan,
                  np.nan, np.nan, np.nan, np.nan, np.nan,
                  np.nan, np.nan, np.nan, np.nan, np.nan,
          -0.15652901, np.nan, np.nan, np.nan, np.nan,
                  np.nan, -0.2219407 , -0.33739475, -0.27092199, -0.32020045,
                  np.nan, np.nan, np.nan])]

single_sources = [ColumnDataSource({'x_line': xs[i], 'y_line': ys[i]}) for i in range(7)]

As you can see the data contains a lot of nans, could this be the problem?

Finally I plot like this:
f = figure(toolbar_location=None, title='Planjaar alle wegen')
f.xaxis.axis_label='Leeftijd'
f.yaxis.axis_label='PCA_1'
for i,col,lbl in zip(range(7),colors_pljr,labels):
  r = f.line(x='x_line', y='y_line', alpha=0.5, line_width=2, source=single_sources[i], line_color=col, legend=lbl)
f.legend.location = "top_left"
f.legend.click_policy="hide"

NOTE: this example actually plots just fine, it is only when I try to make the full 40,000+ line plot that the rendering becomes unbearably long (multiple minutes).

I have also added a CheckboxGroup. In the full plot it again can take a minute or more before the callback is actually called.

Could anybody point out what I am missing?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/07b8e331-800a-4f94-8def-09ecb72f5790%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.