Window-smoothing widget for line plots?


I wondered if there’s any window-smoothing widget for computing a window-averaged line from the points in a line plot? Would be nice to see if there is any difference between the blue and orange lines amidst the noise.

Thanks in advance!

I don’t think there’s anything out of the box. This is probably relevant though, I turned a slider widget into a “smoother”. → Resample ColumnDataSource in CustomJS? - #4 by gmerritt123

It’s a pretty old post, better means of importing external JS resources in callbacks exist now (thanks @mateusz ), but perhaps you can leverage the logic presented regardless.

1 Like

Ahh thanks @gmerrit123. That does look nice and is exactly the feature I’m looking for. At the moment I don’t think I have the resources to incorporate it into my own app in a maintainable way from the looks of it, but I will keep this in mind.

Just for some context, at this stage Bokeh mostly confines itself to computations on data only for things that are directly relevant for rendering, e.g scale transforms, color mapping, grouping, etc.with only a handful of notable exceptions for instances where preparing the data correctly itself is a challenge. [1] We have our hands full enough with the plotting and interactions, so we leave opinionated “non-vis” features to others. [2]

If you want analytical functions on the “Python side” we leave that mostly to higher-level tools built on Bokeh (e.g. Holoviews) or to adjacent tools users can adapt to their specific needs (e.g NumPy, Pandas, etc). And if you want analytical functions on the “JavaScript side” we try to provide ample CustomJS hooks for users to serve their own needs.

  1. These exceptions mostly include hex-binning and contour plotting. ↩︎

  2. There are lots of considerations for smoothing, for instance. There’s nothing we could implement that wouldn’t fail to satisfy many people, and lots of other tools exist that are better-suited for users to get exactly what they need. ↩︎

1 Like

Hi Bryan,

Ahh cool - yes, I understand that it probably wouldn’t be a good idea to try to incorporate niche tools into a core set of widgets. I’ll keep it in mind in any case.

Thanks again,


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.