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.
A character()
vector listing unique cell types.
Choice of base pallet "classic"
, "gg"
, or "tableau"
.
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 = "\\."
).
A logical(1)
indicating whether to make a plot to preview
the colors.
A named character()
vector of R and hex color values compatible
with ggplot2:scale_color_manual()
.
create_cell_colors(pallet = "classic")
#> Astro Micro Oligo OPC Inhib Excit
#> "3" "4" "5" "6" "#E41A1C" "#377EB8"
create_cell_colors(pallet = "classic", preview = TRUE)
#> Astro Micro Oligo OPC Inhib Excit
#> "3" "4" "5" "6" "#E41A1C" "#377EB8"
create_cell_colors(pallet = "tableau", preview = TRUE)
#> Astro Micro Oligo OPC Inhib Excit
#> "#1F77B4" "#AEC7E8" "#FF7F0E" "#FFBB78" "#2CA02C" "#98DF8A"
## 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
)
#> A.1 A.2 B.1 C D
#> "#F8766D" "#A3A500" "#00BF7D" "#00B0F6" "#E76BF3"
## 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
)
#> A B C A.1 A.2 B.1
#> "#F8766D" "#00BA38" "#619CFF" "#F8766D" "#FBBAB5" "#00BA38"