Skip to content

Sequential/Diverging defaults #2925

Closed
Closed

Description

@nicolaskruchten

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.

Activity

  1. nicolaskruchten commented on Aug 18, 2018

    @nicolaskruchten
    ContributorAuthor

    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.

  2. alexcjohnson commented on Aug 18, 2018

    @alexcjohnson
    Collaborator

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

  3. nicolaskruchten commented on Aug 18, 2018

    @nicolaskruchten
    ContributorAuthor
  4. nicolaskruchten commented on Nov 3, 2018

    @nicolaskruchten
    ContributorAuthor

    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.

  5. jonmmease commented on Nov 3, 2018

    @jonmmease
    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).

  6. nicolaskruchten commented on Nov 3, 2018

    @nicolaskruchten
    ContributorAuthor
  7. jonmmease commented on Nov 3, 2018

    @jonmmease
    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.

  8. nicolaskruchten commented on Nov 3, 2018

    @nicolaskruchten
    ContributorAuthor
  9. jonmmease commented on Nov 3, 2018

    @jonmmease
    Contributor

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

  10. alexcjohnson commented on Nov 3, 2018

    @alexcjohnson
    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?

  11. nicolaskruchten commented on Nov 3, 2018

    @nicolaskruchten
    ContributorAuthor
  12. self-assigned this
    on Nov 19, 2018
  13. antoinerg commented on Nov 20, 2018

    @antoinerg
    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

  14. nicolaskruchten commented on Nov 20, 2018

    @nicolaskruchten
    ContributorAuthor

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

  15. added
    feature
    on Nov 20, 2018
  16. etpinard commented on Nov 20, 2018

    @etpinard
    Contributor
    • layout.colorscale.sequential
    • layout.colorscale.sequentialminus (similar to error bar's arrayminus)
    • layout.colorscale.diverging
  17. archmoj commented on Nov 20, 2018

    @archmoj
    Contributor

    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.

  18. nicolaskruchten commented on Nov 22, 2018

    @nicolaskruchten
    ContributorAuthor

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

  19. antoinerg commented on Nov 23, 2018

    @antoinerg
    Contributor

    Closed via #3274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions