How speed up zoom/pan in layouts with many plots

One more update on this. Precisely, the layout is updated when the width of the characters used in the ticks increases/decreases. For example, that can be because the max range for x goes from 9 to 10 or because it goes from 0 to -1. But I found out that because the default font in Bokeh is a proportional font, the total width may still change even if the characters stays the same. So I recommend switching to a monospaced font for more consistent behavior.

With these example settings, no layout will need to be recomputed as long as the x_range and y_range stay within (-100, 1000). It is incredibly smooth and pleasant even with thousands of points and over 30 plots. Numbers within these ranges can be displayed with 6 characters. If you zoom/pan out farther, 7 characters will be needed for the ticks, e.g. -100.00. If you know the range of your data beforehand, you can set the correct width/precision in the formatting and appropriate bounds for the ranges, so the user can not accidentally scroll beyond that.

 p.xaxis.major_label_text_font = 'courier'
 p.yaxis.major_label_text_font = 'courier'

 p.xaxis[0].formatter = PrintfTickFormatter(format="%6.2f")
 p.yaxis[0].formatter = PrintfTickFormatter(format="%6.2f")
1 Like