x <- c(1:3, NA, 3:5)
(pal1 <- palette_colors(
x,
palette = "Spectral"
))
(pal2 <- palette_colors(
x,
palcolor = c("red", "white", "blue")
))
(pal3 <- palette_colors(
x,
palette = "Spectral",
n = 10
))
(pal4 <- palette_colors(
x,
palette = "Spectral",
n = 10,
reverse = TRUE
))
(pal5 <- palette_colors(
x,
palette = "Spectral",
matched = TRUE
))
(pal6 <- palette_colors(
x,
palette = "Spectral",
matched = TRUE,
NA_keep = TRUE
))
show_palettes(
list(pal1, pal2, pal3, pal4, pal5, pal6)
)
# Use Chinese color palettes
palette_colors(
x = letters[1:5],
palette = "ChineseRed",
type = "discrete"
)
palette_colors(
x = letters[1:5],
palette = "Chinese",
type = "discrete"
)
all_palettes <- show_palettes(return_palettes = TRUE)
names(all_palettes)
Run the code above in your browser using DataLab