my_palette: My preferred pallettes generator

View source: R/my_palette.R

my_paletteR Documentation

My preferred pallettes generator

Description

A few of my favorite and most used (discrete) palettes. Some are just base R colors put into a vector. Others come from the following sources: https://github.com/mwaskom/seaborn/blob/master/seaborn/palettes.py https://personal.sron.nl/~pault/

Usage

my_palette(name, type = c("discrete", "continuous"))

Arguments

name

Name of desired palette. Choices are: sb_deep, sb_muted, sb_pastel, sb_bright, sb_dark, sb_colorblind, lancet_colors, jco_colors, basic_colors, qualitative_colors, tol_colors

type

Either "continuous" or "discrete". Use continuous if you want to automatically interpolate between colours.

Details

Adapted from [karthik/wesanderson](https://github.com/karthik/wesanderson) and [dill/beyonce](https://github.com/dill/beyonce)

Value

A vector of colours.

Examples

library(tidyverse)
my_palette("tol_colors")
my_palette("tol_colors") %>%
  view_palette()
ggplot(data = mtcars, aes(x = factor(cyl), fill = factor(vs))) +
  geom_bar(stat = "count") +
  scale_fill_manual(values = my_palette("tol_colors"))
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
  geom_point(size = 3) +
  scale_color_manual(values = my_palette("lancet_colors")) +
  theme_minimal()



emilelatour/laviz documentation built on Nov. 11, 2024, 9:42 p.m.