Bokeh webgl backend is quite nice

from tornado.ioloop import IOLoop
from bokeh.server.server import Server
from bokeh.application import Application
from bokeh.application.handlers.function import FunctionHandler
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource
from bokeh.palettes import Viridis6

import numpy as np

def app_function(doc):
    req = doc.session_context.request
    fig = figure(title=f'{req.arguments=}', width=1800, height=800, 
    N = 200000
    x = np.linspace(0, N, N)
    for l in range(1, 6):
        y = np.sin(x / (10000 * l)) + np.random.randn(N) * 0.02
        cds = ColumnDataSource(dict(x=x,y=y))
        fig.line('x', 'y', source=cds, color=Viridis6[l], line_width=2.0)

handler = FunctionHandler(app_function)
app = Application(handler)

server = Server({r"/": app}, port=5008, io_loop=IOLoop.current())
print('Running on port 5008')

With this script I’m able to plot 1M datapoints (5 lines of 200k points each). Doing a wheel-zoom I get about 5 frames per second, with flawless rendering. I do notice my laptop starts to rev a bit.

Unfortunately don’t know how to convert my webm video, but here are some images!

Nice work, whoever wrote this!

1 Like

Thanks for the kind words! It’s been a collaborative effort involving many folks over the years, most recently @Ian_Thomas and @mateusz