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.
MRE:
Use-case context:
I initially set
palette.qualitativeas 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 custompalette.qualitativethat is distinct frompalette.sequentialand also supports arbitrary many groups.