Color-coded time series visualization with multiline or segment glyphs

I have a UI where segments of a time series are interactively selected and labeled / classified. These segments are then color-coded accordingly.

To support this requirement to color-code different segments of a curve, I can use either MultiLine or Segment glyphs.

Based on the comments in the following Discourse topic, there is apparently a bug in visualization with certain glyphs using datetime axes, and this appears to affect my use-case with MultiLine and Bokeh 2.2.3. Things seem to work well in terms of displaying and updating with a Segment glyphs.

https://discourse.bokeh.org/t/datetime-with-multi-line-and-cds/6777

With that background, a two-part question is (i) is there an envisioned timeframe (order-of-magnitude) when this bug is planned to be addressed? and (ii) generally, is it more efficient to update multiline or segment glyphs?

For context, I have approximately n=100,000 points in the data source, and thus n-1 multilines, but the updates are being done with a source data patch to smallish numbers of these at any one time.

Hi @_jm,

Here’s the GH issue on that bug, for reference:

I’ve asked the developer who’s likely to do the work on this one for an ETA, and I’ll update here when we get a plan.

1 Like

@_jm,

I got confirmation that this will go in 2.3, which should come out before the end of 2020.

Re your second question about the efficiency of multiline vs segments, it’s difficult to say without a better understanding of what your data looks like. What you describe doesn’t sound quite like a “normal” application of MultiLine, more like just a regular line, so maybe a snippet of your data would help?

@carolyn

Thanks for the detailed responses and thoughtful answers to all parts of the question.

My data are typically uniformly sampled measurements from a group of sensors. To your point, these are most naturally plotted with normal line glyphs.

The use of MultiLine or Segment glyphs stems from the requirement that I am color-coding various segments of the data to indicate that those regions correspond to events of interest, e.g. “excessive acceleration happened here”, “GPS dropout here”, “over-temperature here”, etc.

My understanding is that the. bokeh line glyph does not support multiple colors, hence the use of MultiLine or Segment.

Ah, thanks! That makes sense.

In your use case, it seems like MultiLine is the way to go, just because it’s easier to update contiguous subsections of a MultiLine rather than having to update a bunch of individual, adjacent segments. Of course, until the bug gets fixed, the best solution is the one that works. :slight_smile:

1 Like