Datashading with bokeh

Hi! Have you tried datashading with bokeh? or it is only possibly with holoviews?

1 Like

Datashading is possible with Bokeh. However, according to the datashader docs, Holoviews work best with datashader if you want continuous datashading upon zoom.

oh thanks!!! I understand now and I guess the datashade with bokeh in jupyter notebook works, but not when running in the server.

I guess the datashader with bokeh in jupyter notebook works, but not when running in the server.

I don’t think this is an accurate statement. Datashader by itself only generates RGBA images, and Bokeh can display these images under any circumstance (notebook, file, or server output). But if what you are after is automatic image updates, e.g. in response to panning and zooming, then its worth nothing a few things:

  • that requires a Bokeh server (in or our of the notebook) because Datahshader is a real Python library, and only Bokeh server callbacks an execute real Python code

  • If you are just using core Bokeh, then you would need to set up all the callbacks and events to do the Datashader re-computations on your own, manually.

This last bullet is what Holoviews helps greatly with. It has built-in features designed to make the necessary connection between Bokeh and Datashader for you, so that everything appears seemless at a high level.

Purely for historical interest, I’ll mention that very early on the plan was for something like Datashader to exist as part of Bokeh itself. If you see old posts or announcements, you might see references to something called “Abstract Rendering”. That was the precursor to Datashader. Ultimately, this first plan did not work out:

  • Abstract Rendering derived from an academic project written in Java, and the port to Python was not ever able to integrate cleanly with the rest of the project
  • This was also around the time of first (failed) Bokeh server. The first-generation Bokeh server simply did not provide the capabilities necessary to support the original vision of automatica progressive refinement and fine-grained render control tied to UI events.

So, it was decided to explore the concepts around Abstract Rendering in a new self-contained project that had a more focused scope on just the advanced rendering ideas. This was how Datashader was born. Eventually the second (current) Bokeh server was developed, and after some time, both it and Datashader matured to a point were a project like Holoviews could put them together in a meaningful and powerful way.