-
Notifications
You must be signed in to change notification settings - Fork 109
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
[Bug] Change default continuous color scale to SEQUENTIAL_CYAN
#407
Conversation
autocolorscale
for assignment of correct continuous color palettesautocolorscale
for correct assignment of color sequences
Ah yes, that needs to be reversed! It came out of a discussion I've had with @antonymilne where he rightfully pointed out that in the above example it shouldn't be a diverging color sequence but a sequential one. These two color sequences have different meanings in color theory. I can recommend reading this article:
A sequential color sequence indicates to the user that the color category goes from low to high with no specific meaning to any of the mid-values (which is the case for life expectancy). For example, if you look at the screenshot you've sent - a neutral white color is assigned to the life expectancy in the range of 50-60 years, but there is no meaning behind this. A diverging color sequence should usually be applied if you e.g. have positive and negative values. The neutral mid color will then highlight the 0 values normally, so here it has a meaning. So choosing a sequential or diverging color sequence does have an impact on how people could interpret the colors. Is that clearer now? |
@huong-li-nguyen , thanks a lot for the explanation and the link (the article is excellent!). All these changes make sense to me now 😄. P.S. I've updated the screenshot from the PR description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the change, this is a huge improvement! I knew something like coloraxis_autocolorscale=True
should exist so great to see it does exactly what we need 😀
Just one thing though: do we definitely want the colors this way round? So that blue = high and red = low. To me this feels backwards since it's the opposite of a temperature scale that goes from blue = cold to red = hot so it would feel more natural to me to have blue = low and red = high.
Definitely I agree that we should be consistent between sequential and diverging palettes so that the same color always means the same thing, but to me these should be completely reversed everywhere.
Edit: just read through the excellent articles you posted to see if they said anything on this. Seems like they have examples of the blue -> red scale and the red -> blue scale both ways round so there's no clear convention on this? THey do say this though:
I bet that in Mike Bostock’s visualization, you had to study the color legend for a few seconds to understand that red doesn’t signify “more births”, but fewer.
So when using diverging color scales, take an extra minute to think about your color choices. Which ones would be the most intuitive colors for your readers (e.g. party colors, or red = bad)? And how can you make clear which color means which extreme? Label your color legend well and/or turn your title into a color key, and use annotations in the chart to remind readers what they see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐ Love it! Reminds me of our discussion back about the colors of the scatter plot! This is really how it should be :)
Have you checked if this affects any custom choices? I would assume color_continuous_scale
and color_continuous_midpoint
still work (e.g. when I would like the middle of my diverging scale to be a certain value)
Tricky - I feel like that since we have this automation specifically for negativ to positive numbers, I am more comfortable with red = negativ, blue = positive (green would probably make this even more clear...) |
@antonymilne - the answer is it depends 😄 I did ask Joe and Dan about the current choice and they both agreed that blue represents positive values, and red represents negative values and intuitively I also thought so. However, I definitely understand your confusion and I don't think this color sequence is crystal clear. But the direction of color sequence not only depends on the +/n sign but actually the context of your data. In the example below, the negative values are represented by green, and the positive values by red. Now you might think: Shouldn't it be vice versa? In this case, it depends. If the desired parameter/outcome is actually a negative value (let's say -40% is our target), then green color is correctly assigned to the negative values, because green is usually thought of as the positive outcome color. Positive in the sense of desired result. Regarding @maxschulz-COL comment on green-red, we always try to avoid that due to accessibility concerns (red-green color blindness which is actually quite common), so that's we use blue-red. I don't think the diverging red-cyan will always represent the color sequence correctly because it depends on the data context and the example above also shows that negative values do not always represent negative outcomes. So I don't think we can get it right for every use case. I would therefore stay with the current choice as it's Dan's preference. |
Very good point @maxschulz-COL !! I just tried that out and it is not compatible 😭 So maybe that was the reason we didn't turn it on in the past 🤔 Here for context: https://stackoverflow.com/questions/61083382/plotly-make-subplots-doesnt-keep-selected-colors This means however, we have a choice to make:
Both approaches have pros and cons..any preferences? @antonymilne @maxschulz-COL @petar-qb @Joseph-Perkins |
We decided to go for option 2) for easy use for users to still customise their color sequences. |
for more information, see https://pre-commit.ci
…ey/vizro into tidy/change_theme_default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-approving with the new solution 😀 Thanks for the excellent discussion and code comments that make it all clear!
vizro-core/changelog.d/20240405_135655_huong_li_nguyen_change_theme_default.md
Outdated
Show resolved
Hide resolved
autocolorscale
for correct assignment of color sequencesSEQUENTIAL_CYAN
Description
autocolorscale=False
but add explanation on why this needs to be turned off, see this thread: [Bug] Change default continuous color scale toSEQUENTIAL_CYAN
#407 (comment)SEQUENTIAL_CYAN
Screenshot
Run dev example:
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":