A lightweight package for the Ontario Neurodegenerative Disease Research Initiative (ONDRI) color palettes. Returns a palette object (vector of colors) similar to Wes Anderson Palettes (https://github.com/karthik/wesanderson). The palette attributes certain colors to cohort labels.
ONDRI's color palettes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
## quick visualization of palettes
## continuous example
pal1 <- ondri_palette(name = "all_colours", start = 3, n = 20, is_discrete = FALSE)
image(volcano, col = pal1)
## discrete example
pal2 <- ondri_palette(name = "cohorts")
image(volcano, col = pal2)
## three toy examples
library(ondricolors)
data("toy_ONDRI_data")
## first in base R
## for the filled pchs
col2use <- ondri_palette("cohorts")[as.character(toy_ONDRI_data$COHORT)]
plot(toy_ONDRI_data$X, toy_ONDRI_data$Y, col = col2use, pch = 20)
plot(toy_ONDRI_data$X, toy_ONDRI_data$Y, bg = col2use, pch = 21)
## now with ggplot2
library(ggplot2)
ggp_color <- ggplot(toy_ONDRI_data, aes(x = X, y = Y, color = COHORT)) +
geom_point() +
scale_color_manual(values = ondri_palette("cohorts"))
ggp_color
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.