Looking for library for cbPalette

When run following code, got error message: Error in is_missing(values) : object 'cbPalette' not found

What library includes cbPalette? Thank you.

data(cbPalette)

df <- data.frame(species = c(rep("dog", 3), rep("cat", 3)), 
                 weight = c(5, 10, 12, 7, 4, 5), 
                 height = c(3.2, 4.5, 4.7, 4, 3.5, 3.3))
ggplot(data = df, aes(x = height, y = weight, color = species)) + 
  geom_point() + 
  geom_line() + 
  scale_colour_manual(values=cbPalette)

There's one in the {Ternary} package and the ]{colorspace}package]([1903.06490] colorspace: A Toolbox for Manipulating and Assessing Colors and Palettes) provides a suite of tools to generate color safe palettes to use in ggplot

library(ggplot2)

cbPalette <- c("#a6cee3", "#1f78b4")

df <- data.frame(
  species = c(rep("dog", 3), rep("cat", 3)),
  weight = c(5, 10, 12, 7, 4, 5),
  height = c(3.2, 4.5, 4.7, 4, 3.5, 3.3)
)
ggplot(data = df, aes(x = height, y = weight, color = species)) +
  geom_point() +
  geom_line() +
  scale_color_manual(values = cbPalette) +
  theme_minimal()

Created on 2023-05-13 with reprex v2.0.2

1 Like

Thank you for your response!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.