create_cell_colors: Create a cell color pallet for plots

View source: R/create_cell_colors.R

create_cell_colorsR Documentation

Create a cell color pallet for plots

Description

This function returns a character() vector with valid R colors for a given input character() of unique cell types. These were colors that have been useful in our experience.

Usage

create_cell_colors(
  cell_types = c("Astro", "Micro", "Oligo", "OPC", "Inhib", "Excit"),
  pallet = c("classic", "gg", "tableau"),
  split = NA,
  preview = FALSE
)

Arguments

cell_types

A character() vector listing unique cell types.

pallet

Choice of base pallet "classic", "gg", or "tableau".

split

delineating character(1) after which suffixes will be ignored. This is useful for cases when say A.1 and A.2 are both to be considered as cell type A (here split = "\\.").

preview

A logical(1) indicating whether to make a plot to preview the colors.

Value

A named character() vector of R and hex color values compatible with ggplot2:scale_color_manual().

Examples

create_cell_colors(pallet = "classic")
create_cell_colors(pallet = "classic", preview = TRUE)
create_cell_colors(pallet = "tableau", preview = TRUE)

## Consider A.1 and A.2 as two different cell types (default)
create_cell_colors(
    cell_types = c("A.1", "A.2", "B.1", "C", "D"),
    pallet = "gg",
    preview = TRUE
)

## Consider A.1 and A.2 as cell type A by using the "split" argument
create_cell_colors(
    cell_types = c("A.1", "A.2", "B.1", "C"),
    split = "\\.",
    pallet = "gg",
    preview = TRUE
)

LieberInstitute/DeconvoBuddies documentation built on Dec. 16, 2024, 10:32 p.m.