Skip to content

Allow for discrete color scales with fewer than three colors #670

@RoyalTS

Description

@RoyalTS

This slight variation on an example from the docs throws a warning:

> plot_ly(iris, x = Petal.Length, y = Petal.Width,
          color = Sepal.Length>6, colors = c("#132B43", "#56B1F7"),
          mode = "markers")


Warning message:
In RColorBrewer::brewer.pal(N, "Set2") :
  minimal value for n is 3, returning requested palette with 3 different levels

I asked about this on SO and the issue seems to be that build_plotly() shouldn't be calling brewer.pal() if the data has fewer than three classes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions