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

Update frequencies tooltips and include projection pivot #777

Merged
merged 4 commits into from
Aug 28, 2019

Conversation

trvrb
Copy link
Member

@trvrb trvrb commented Aug 26, 2019

@jameshadfield, @rneher ---

This PR is motivated by @huddlej's recent flu forecasting work. We thought it best to not mess with the underlying data structure of tip-frequencies.json. We've kept this JSON structure exactly as before but just included an additional attribute of projection_pivot:

{
 "A/Aberystwyth/5949/2018": {
  "frequencies": [
   0.0,
   0.0,
   0.0,
...
  ]
 },
...
 "pivots": [
  2017.67,
  2017.75,
  2017.83,
...
 ],
 "projection_pivot": 2019.67
}

This way the frequency streamplot can be drawn as before, but we just mark down with a dashed line what derives from empirical augur frequencies and what derives from a forecast.

Screen Shot 2019-08-26 at 9 41 25 AM

I've added state.frequencies.projection_pivot to redux to accomplish this. If you want a dataset to demo this with use: https://nextstrain.org/staging/flu/seasonal/h3n2/ha/2y

Importantly, this is backward compatible with previous versions of auspice. The forecast will still show correctly, but we just won't get the dashed projection pivot.


Additionally, this improves frequencies tooltips to be specific to the frequency bin rather than show a full vertical line, as so:

Screen Shot 2019-08-26 at 9 44 51 AM

And makes a few aesthetic improvements (white text on black background and tooltip placement).

This commit:
1. Makes the vertical tooltip line follow the frequency bin rather than taking up the entire vertical.
2. Makes the tooltip aligned with the pivot rather than the mouse point. This prevents the tooltip from occluding the marker line.
3. Makes the tooltip styling match the dark background / white text used in tree tooltips. This increases aesthetic consistency.
@jameshadfield
Copy link
Member

jameshadfield commented Aug 27, 2019

Looks good -- excited to see what @huddlej's cooking up

Tested and confirmed no regressions with current datasets (i.e. those lacking projection_pivot). Tested new functionality by adding "projection_pivot": 2019.25 to http://staging.nextstrain.org/flu_seasonal_h3n2_ha_2y_tip-frequencies.json (it wasn't there, BTW) and behaves as per your screenshots.

Did you investigate changing the color / opacity of the streams to the right of the projection_pivot? and/or adding some text directly above the graph to the right of the dashed line? and/or adding something in the hover info box to indicate that it's projected frequency? It wouldn't be obvious to me what the line represents, especially when the dates to the right of it are within the date range of the dataset.

@jameshadfield
Copy link
Member

Happy for this to be merged by @trvrb / @huddlej. I'll release new auspice / nextstrain.org when I see it's been merged.

@trvrb
Copy link
Member Author

trvrb commented Aug 28, 2019

Thanks for the feedback James. I agree that the fact this is a projection is opaque. I'll experiment with strategies to visually distinguish before and after.

This commit updates two aspects of projection frequencies:
1. Adds a "Projection" label centered over the projected portion of the frequencies streamgraph
2. Changes tooltip labeling to "Projected frequency" when appropriate
@trvrb
Copy link
Member Author

trvrb commented Aug 28, 2019

Okay. I made a couple minor changes to try to make projection more obvious. These were to:

  1. Add a "Projection" label centered over the projected portion of the frequencies streamgraph
  2. Change tooltip labeling to "Projected frequency" when appropriate

Screen Shot 2019-08-28 at 9 40 01 PM

@trvrb
Copy link
Member Author

trvrb commented Aug 28, 2019

@jameshadfield: I'm going to merge this. Thanks again. Any additional aesthetic changes can happen on top of master.

@trvrb trvrb merged commit 7d1d54e into master Aug 28, 2019
@trvrb trvrb deleted the projection-pivot branch August 28, 2019 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants