-
Notifications
You must be signed in to change notification settings - Fork 162
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
Continous color scale improvements #1340
Conversation
Awesome! I think this is an excellent direction. Working through this, I had some thoughts / observations mainly on the JSON schema:
My main immediate issue: I'd think that
and expected to have a the same tree coloring It's currently a gotcha that I'd also see a possible
This works for
If you have a tip with |
Oops -- I created this in the JSON used for testing at the start, but then realised that
Agreed - similar to how
Our tip-matching logic is inclusive: |
I love this new interface, @jameshadfield! I can't wait to start using it in production. One potentially silly issue I couldn't figure out is how to view the staging data from the Heroku deployment. When I go to the deployment or add |
It's not you - this review app is from auspice, which has no concept of "staging" sources, |
The schema currently allows datasets to provide a scale for non- continuous scales where specific trait values are given colour hexes (missing values are given greys by auspice). Here we extend this to continuous scales by interpreting the same data structure as anchor points which we interpolate between using the same method as we currently use for generating default continuous color scales (d3's `interpolateRgb`)
This allows continuous colour scales to define custom legend entries, via a `legend` key in the JSON. This allows control over the values in the scale which we use as legend elements, the displayed text, and the range of values which each entry covers. Bounds are enforced to be non-overlapping. If overlapping bounds are detected, we revert to Auspice dynamically generating these. (This is a requirement for future work which will map continuous tip values to a legend entry, which will allow pie-chart display using the legend swatches.)
This restores the algorithm used to associate a hovered legend item to tips for continuous variables. Commit 0f37b1a (Mar 2018) incorrectly changed this to `tip \in [a, b]` rather than the intended (and documented) `tip \in (a, b]`. This takes on more importance given that the previous commit allows user-defined bounds. Note that the frequencies panel already used `(a, b]` matching, so now the legend matching mirrors this.
5b62621
to
aa94ea2
Compare
Thanks both! I've updated the code to address points raised. The test dataset (https://staging.nextstrain.org/ncov_global_custom-continuous-colouring.json) has been updated to showcase these - every coloring there has some custom elements added!
|
This is fantastic James. Everything looks great to me at this point. I'd be in favor of merging. |
These updates allow specification of custom legend info via the auspice config JSON which is schema-validated and exported. This functionality is utilised by auspice 2.26.0 (see nextstrain/auspice#1340 for more).
Auspice 2.26.0 can now use custom colors for continuous scales via the `scale` property on such a coloring; previously custom colors were only available for discrete scales (see nextstrain/auspice#1340 for more). Here we extend the schema for the auspice config JSON and update `augur export` to allow export of such scale information for continuous colorings. Previously, scale information (for discrete scales) could only come from a colors TSV file supplied via `augur export --colors <TSV>`. We now allow this to be specified in the auspice config JSON, and use this information preferentially over the TSV.
These updates allow specification of custom legend info via the auspice config JSON which is schema-validated and exported. This functionality is utilised by auspice 2.26.0 (see nextstrain/auspice#1340 for more).
Auspice 2.26.0 can now use custom colors for continuous scales via the `scale` property on such a coloring; previously custom colors were only available for discrete scales (see nextstrain/auspice#1340 for more). Here we extend the schema for the auspice config JSON and update `augur export` to allow export of such scale information for continuous colorings. Previously, scale information (for discrete scales) could only come from a colors TSV file supplied via `augur export --colors <TSV>`. We now allow this to be specified in the auspice config JSON, and use this information preferentially over the TSV.
Auspice 2.26.0 can now use custom colors for continuous scales via the `scale` property on such a coloring; previously custom colors were only available for discrete scales (see nextstrain/auspice#1340 for more). Here we extend the schema for the auspice config JSON and update `augur export` to allow export of such scale information for continuous colorings. Previously, scale information (for discrete scales) could only come from a colors TSV file supplied via `augur export --colors <TSV>`. We now allow this to be specified in the auspice config JSON, and use this information preferentially over the TSV.
Extends the dataset JSON to allow continuous colorings to provide a scale, which we interpolate between to get the colour scheme, and custom legend data, which allows controlover the values in the scale which we use as legend elements, the displayed text, and the range of values which each entry covers.
Closes nextstrain/ncov#617
Following examples available via https://staging.nextstrain.org/ncov_global_custom-continuous-colouring.json
Custom legend stops
Left: this PR, Right: current master
Custom scale, legend stops, values and bounds
Left: this PR, Right: current master