holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.71k stars 403 forks source link

[Feature Request] Horizon Chart #3806

Open cassiotbatista opened 5 years ago

cassiotbatista commented 5 years ago

Following a suggestion I received on Bokeh Discourse page, wouldn't it be nice to have a Horizon chart / plot in Holoviews similar to those Bokeh used to support in earlier 0.12 versions?

horizon

poplarShift commented 5 years ago

I may be ignorant but I've never come across these. Quoting https://rpubs.com/ramanraja/horizon:

(1) Both positive and negative values are plotted above the x axis. Color is used to differentiate between them. Positives are blue, negatives are red. Think of it as an origami. You fold the paper horizontally at the center, so postive and negative parts are now packed within the upper half of the paper.

(2) Cut the graph along the dotted lines and fold them back. But now they will overlap. To differentiate between high and low numeric values, color saturation is used: darkest blue represents largest positive numbers; medium blue stands for moderate values; and pale blue represents the smallest positive values. Similarly on the negative side. Note that there are three shades each of blue and red, corresponding to the three levels of cut we have made.

Is this what you're after? I must say I don't find them super intuitive but that may be just me.

cassiotbatista commented 5 years ago

@poplarShift yes, that's exactly what I'm after. I'm new to data viz but I find myself in the very same situation stated by the link you provided:

Line graphs are best suited for Time Series data. But if a large number of such plots have to be compactly presented on a cramped dashboard, they tend to become less useful. [...] Horizon plots are ideally suited for this situation.

poplarShift commented 5 years ago

Well with bokeh, panel, and other interactive technology around, the cramped dashboard argument does not really convince me :) though in print it may be worth the hassle of explaining to the reader what all of the colours mean.

As a first solution (workaround?) one could implement the wrapping manually, transforming one timeseries into one timeseries per section of y coordinate, and then overlay them as Area elements. Could even be done as operation.

cassiotbatista commented 5 years ago

I'm working (trying to work, at least) on workaround based on Bokeh's ridge plot, but I'm having some interaction issues even with HoverTool which I believe has been highly used and supported.

Furthermore, as you didn't find this implementation request reasonably useful, do you have any other option in mind to visualise multiple time-series data stream in a single plot?

poplarShift commented 5 years ago

Well actually now that I know what it is it doesn't sound that complicated anymore. Your example above though could have profited from a colorbar.

In the end one can see those charts as a twist on normal heatmaps where some of the small-scale gradients are not shown by color but by height inside each row, if that makes any sense.

As I said, you can just do the clipping and folding yourself, then make an NdOverlay of several hv.Area elements and maybe get some inspiration here: https://github.com/poplarShift/pyviz-recipes/blob/master/notebooks/styling_by_attribute.ipynb on styling their colors according to a colormap. I currently don't have a use case for it but if anyone wants to implement it more principally as an hv.Operation that shouldn't be too hard.

Oh, and as for alternatives, since users can pan and zoom and hover as they want, just displaying al timeseries as Areas or Curves would probably suffice for most use cases.