Skip to content

palette.qualitative does not accept a function #593

@katrinabrock

Description

@katrinabrock

MRE:

my_pal <- colorRampPalette(c("red", "yellow", "blue"))
tinyplot(
  1:10,
  by = as.factor(1:10),
  palette = my_pal
)
# works

tinyplot(
  1:10,
  by = 1:10,
  theme = list(palette.sequential = my_pal)
)
# works

tinyplot(
  1:10,
  by = as.factor(1:10),
  theme = list(palette.qualitative = my_pal)
)
# fails

Use-case context:

I initially set palette.qualitative as a vector, but then kept getting the recycle warning when I had more groups than elements of that vector. So I wanted to build a function to programmatically generate an arbitrarily long list of colors that are not necessarily a gradient. I'm not sure how I can set a custom palette.qualitative that is distinct from palette.sequential and also supports arbitrary many groups.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions