Skip to content

Color gradient for numeric path details - #2259

Merged
easbar merged 10 commits into
masterfrom
color_gradient_for_numeric_path_details
Mar 18, 2021
Merged

easbar merged 10 commits into
masterfrom
color_gradient_for_numeric_path_details

Conversation

@easbar

@easbar easbar commented Mar 17, 2021 •

Copy link
Copy Markdown
Member

For numeric path details like time or average_speed its not very useful to use unrelated, random colors in the elevation diagram. Here I am using a linear color gradient for such numeric path details. The gradient uses two fixed colors to represent the minimum/maximum of the encoded value range of the current path (green to red). For discrete values I use a fixed 10-color palette now (leaflet.heightgraph was using a random choice of six color palettes, but to me it seems confusing to see different colors each time).

Not entirely sure about this change yet, any opinions @karussell, @boldtrn?

Here are screenshots of a numeric and a discrete path detail:

image

image

By the way I use the 10-color palette from d3, but maybe not really worth keeping the entire library when all we need is an array of 10 hex codes...

And thanks again for these changes in heightgraph, they are very useful @boldtrn!

This PR is based on #2258.

@easbar easbar added the web label Mar 17, 2021
@easbar easbar added this to the 3.0 milestone Mar 17, 2021
@otbutz

otbutz commented Mar 17, 2021

Copy link
Copy Markdown
Contributor

Can we avoid red/green color shades for colorblind users?

@easbar

easbar commented Mar 17, 2021

Copy link
Copy Markdown
Member Author

Ah and @boldtrn suggested we should use a special color (like grey) for missing values? I think this is a great idea, but how can we reliably recognize missing details?

@easbar

easbar commented Mar 17, 2021

Copy link
Copy Markdown
Member Author

Can we avoid red/green color shades for colorblind users?

Good point! What colors would be better?

Comment on lines +344 to +346
// for numeric details we use a color gradient
var colorMin = [47, 115, 54];
var colorMax = [170, 58, 56];

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@otbutz The min/max colors are specified here

@easbar easbar Mar 17, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the discrete values I am using these colors right now: https://github.com/d3/d3-scale-chromatic#categorical (schemeCategory10) I thought they are pretty, but not sure if they are accessible.

@boldtrn

boldtrn commented Mar 18, 2021

Copy link
Copy Markdown
Member

Ah and @boldtrn suggested we should use a special color (like grey) for missing values? I think this is a great idea, but how can we reliably recognize missing details?

Using the current GH API you can't. GH uses the country fallback speed. This would require a change in the MaxSpeedParser.

Good point! What colors would be better?

As far as I know, any other color should work, I think you can even use red or green, but should avoid both in the same visualization.

So for example we could use blue instead of green (but you are using blue already :)).

@easbar

easbar commented Mar 18, 2021

Copy link
Copy Markdown
Member Author

Using the current GH API you can't. GH uses the country fallback speed. This would require a change in the MaxSpeedParser.

Ah ok. For some encoded values (like road environment) we use 'other', but e.g. for surface we have 'missing'...

any other color should work,

How about this:

image

I found this here: https://uigradients.com/#Superman

@otbutz

otbutz commented Mar 18, 2021 •

Copy link
Copy Markdown
Contributor

Can we avoid red/green color shades for colorblind users?

Good point! What colors would be better?

https://thenode.biologists.com/data-visualization-with-flying-colors/research/

e.g

grafik

@otbutz

otbutz commented Mar 18, 2021

Copy link
Copy Markdown
Contributor

Funnily enough, this was posted on hackernews just recently: https://blog.datawrapper.de/which-color-scale-to-use-in-data-vis/

@easbar

easbar commented Mar 18, 2021

Copy link
Copy Markdown
Member Author

Thanks! I like it :) And it even says "Pale grey is meant for bad data in maps.", so a perfect fit for us ;)

I now hard-coded 'missing' and 'unclassified' to use grey. We can add more values to the 'value missing' list of course.

image

@easbar
easbar merged commit 6ab22f4 into master Mar 18, 2021
@easbar
easbar deleted the color_gradient_for_numeric_path_details branch March 18, 2021 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants