Skip to content

Sequential/Diverging defaults #2925

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

Closed
nicolaskruchten opened this issue Aug 18, 2018 · 17 comments
Closed

Sequential/Diverging defaults #2925

nicolaskruchten opened this issue Aug 18, 2018 · 17 comments
Assignees
Labels
feature something new

Comments

@nicolaskruchten
Copy link
Contributor

colorway is going to be a very useful parameter for the new Themes feature of Chart Studio, because by setting just that attribute and saving it in a template, one will be able to provide custom defaults for colors of new traces, plus pie charts.

I think it will be necessary to add the equivalent custom defaults for sequential and diverging colorscales (overriding the current built-in default white-to-red and blue-to-white-to-red that appear when you first try to color by data in the editor), such that a template can specify just these three to prepopulate the default colors in all three modes: categorical, sequential and diverging.

@nicolaskruchten
Copy link
Contributor Author

To clarify: this would be two new keys in layout, something like layout.sequentialscale and layout.divergingscalewhich would be arrays of color-strings, and whose defaults would be the current defaults plotly.js uses for those kinds of scales when colorscale is not specified.

@alexcjohnson
Copy link
Collaborator

Good idea. To be precise this would be three scales, since we have positive sequential, negative sequential, and diverging.

@nicolaskruchten
Copy link
Contributor Author

nicolaskruchten commented Aug 18, 2018 via email

@nicolaskruchten
Copy link
Contributor Author

This now seems fairly necessary, as Themes support in Chart Studio Cloud doesn't seem to grab the Theme-provided sequential colorscales ... or at least plotly.js isn't offering them up as defaults in fullData ...? http://plot.ly/create and try to make a scatter plot colored by a column with a theme.

@jonmmease
Copy link
Contributor

This would be great. Right now themes have to individually set defaults for every colorscale across all trace types. It would be nice to be able to specify this in one place (or one place for sequential and one place for diverging).

@nicolaskruchten
Copy link
Contributor Author

nicolaskruchten commented Nov 3, 2018 via email

@jonmmease
Copy link
Contributor

I'm not used to thinking of increasing and decreasing as separate colorscale types. Could you elaborate? I was picturing that the defaults would be for sequential and diverging colorscales.

@nicolaskruchten
Copy link
Contributor Author

nicolaskruchten commented Nov 3, 2018 via email

@jonmmease
Copy link
Contributor

Ah, missed that. @alexj how does plotly.js decide which scale to use?

@alexcjohnson
Copy link
Collaborator

Right, the negative sequential is unusual, we only use it when you have uniformly negative data and you ask for autocolorscale (If you don't explicitly ask for autocolorscale we default to the diverging blue->gray->red). The idea being that the goal with a sequential colorscale is generally to vary from a "weak" color representing small values to a "strong" one representing large values, and "larger" more often means "bigger absolute value" than ">"

We could simply flip the positive sequential scale if all the data are negative, but the original thought was that this would be misleading to users used to seeing that scale the other way, so it would be better to use a separate scale.

Could we assume that diverging is the concatenation of increasing and decreasing sequential or do we need all three?

You're right that our defaults are close to that - negative sequential being blue (most negative) to gray (least negative) and positive being gray (least positive) to red (most positive), vs the diverging blue->gray->red. But if we actually used the two concatenated together you'd see that the sequential ones end at a brighter gray than the diverging one, so there's a clear cusp at the boundary - which the diverging one smooths out in the name of perceptual uniformity.
concat vs rdbu

Perhaps if you only specify diverging and sequential, the negative sequential scale defaults to the reversed positive sequential?

@nicolaskruchten
Copy link
Contributor Author

nicolaskruchten commented Nov 3, 2018 via email

@antoinerg antoinerg self-assigned this Nov 19, 2018
@antoinerg
Copy link
Contributor

I am about to submit a PR for this one. What would be good names for those 3 new attributes?

cc @plotly/plotly_js

@nicolaskruchten
Copy link
Contributor Author

layout.colorscales.positivesequential, layout.colorscales.negativesequential, layout.colorscales.diverging ?

@etpinard etpinard added the feature something new label Nov 20, 2018
@etpinard
Copy link
Contributor

  • layout.colorscale.sequential
  • layout.colorscale.sequentialminus (similar to error bar's arrayminus)
  • layout.colorscale.diverging

@archmoj
Copy link
Contributor

archmoj commented Nov 20, 2018

I am curious to know if one could apply diverging reversed?
When having e.g. a topography model it would be nice to have the option of presenting the mountains in red and the elevations below zero in blue.

@nicolaskruchten
Copy link
Contributor Author

@archmoj these are just for defaults... you can definitely reverse the colorscale, there's a different parameter for that :)

@antoinerg
Copy link
Contributor

Closed via #3274

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

No branches or pull requests

6 participants