Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tool that can re-normalize line plots (timeseries) relative to each other in various ways #58

Closed
jrhastings opened this issue Sep 4, 2013 · 5 comments

Comments

@jrhastings
Copy link

Suppose you have 2 or more timeseries and want to plot them as separate lines in a multi-line plot. This works great if the dynamic ranges of each input are similar but can be visually dominated by a single line if that line has a much wider range.

Often a caller to a multi-line plotting API needs to normalize the inputs to make them "fit together". Fortunately, there is a very intuitive/canonical set of normalizations the user might try and several of them are "guaranteed to work" (at least visually).

It would be cool to provide a Bokeh tool (i.e. button like zoom/pan) that could select (or cycle thru?) the normalizations dynamically without the user/programmer needing an expensive break in the workflow. The operations are pretty cheap to compute so this can probably be done from javascript directly.

Here's a set of normalizations:

This first set uses a common y-axis.

  • default: do nothing, it will be dominated by the largest of the dynamic ranges
  • take logs (if both arrays are always positive)
  • subtract first value from each timeseries (so they all start at zero)
  • subtract the means (so they average to zero, but might not start together)
  • subtract the means AND divide by the stddev's (guaranteed to "work")

Alternatively, we can use a separate y-axis for each timeseries. This is similar in spirit to dividing by stddev but has the possible advantage that the user can still read off the raw values. Unfortunately it only works for a small set (2 or maybe 3).

So if there are only a few series you can use separate y-axes and:

  • make the min/max lineup visually
  • make the means lineup visually
  • make the starting value lineup visually

I think this would be pretty useful as a Bokeh tool that could be added to basically any multi-line plot.

@damianavila
Copy link
Contributor

The idea is interesting... but I think it can be developed, for instance, using Bokeh inside a Flask application... I don't know if all those specific features belongs to the Bokeh... @bryevdv, what do you think about that?

@hhuuggoo
Copy link
Contributor

i definitely see the value, I think this is something that could go into the bokeh.charts api, it might be a timeseries plot construction widget of some sort

@jrhastings
Copy link
Author

Hey everybody, I'm literally wresting with the problem this was intended to
solve right now (using matplotlib).

To me, I think "renormalize this curve relative to another" (with a few
common and fairly trivial strategies like in the original post, e.g.
subtract the first value so they all "start at zero") is pretty similar to
zooming and panning, which is why I suggested it live as a Tool.

Arguably this is an "advanced" tool that isn't shown by default, but I
honestly think that anybody who works with multiple curves on a plot will
find these transformations pretty natural.

Thanks!

  • Joe

On Fri, Apr 11, 2014 at 4:19 PM, Damián Avila notifications@github.comwrote:

The idea is interesting... but I think it can be developed, for instance,
using Bokeh inside a Flask application... I don't know if all those
specific features belongs to the Bokeh... @bryevdvhttps://github.com/bryevdv,
what do you think about that?

Reply to this email directly or view it on GitHubhttps://github.com//issues/58#issuecomment-40249103
.

@damianavila
Copy link
Contributor

@hhuuggoo, yes I was thinking in a sort of widget too...

@jrhastings, having played (and still playing) with cointegrated models, I know you are asking for pretty natural tools in the time series analysis area... but advanced for common users.
I think the @hhuuggoo's idea has the best fit for the tools you are asking for...

Your ideas are very interesting so I make some noise to contrast ideas 😉

@bryevdv
Copy link
Member

bryevdv commented Jun 5, 2014

I agree some of this could go in the bokeh.charts interface. I am going to close this ticket, but reference it in the bokeh.charts issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants