Derek Beaton & Jeremy Tanuan 2020SEP09
Standardized themes, colors, and templates for the ONDRI project’s
colors and presentations. Developed by Jeremy Tanuan and Derek
Beaton.The package is heavily influenced by and copies key parts of
Karthik Ram’s wesanderson
palette
package.
Make sure you have R and RStudio. Open RStudio and run the following commands in the RStudio console (the bottom left pane) to install the necessary packages if you have not already done so.
First install the ondricolors
package
if(!require('devtools')){
devtools::install_github(repo = "ondri-nibs/ondricolors")
}
## Loading required package: devtools
## Loading required package: usethis
Then load the package as
library(ondricolors)
You will know that the packages are loaded if the checkbox beside each in the Packages tab (the bottom right pane) are checked. Add the checkmark to each for any that are missing from the necessary packages.
Depending on your flavour (flavor) of English, we provide
ondri_palette("all_colours")
or alternatively
ondri_palette("all_colors")
ondri_palette("cohorts")
Let’s see the palette colors
# See all ONDRI palettes
names(ondri_palettes)
## [1] "all_colours" "all_colors" "cohorts"
Here we provide an example with ggplot2
.
library(ggplot2)
library(ondricolors)
data('toy_ONDRI_data')
ggp_color <- ggplot(toy_ONDRI_data, aes(x = X, y = Y, color = COHORT)) +
geom_point() +
scale_color_manual(values = ondri_palette("cohorts"))
ggp_color
And here we provide an example with base R
library(ondricolors)
data('toy_ONDRI_data')
## for the filled pchs
plot(toy_ONDRI_data$X, toy_ONDRI_data$Y, col = ondri_palette("cohorts")[as.character(toy_ONDRI_data$COHORT)], pch = 20)
## for the pchs with bgs
plot(toy_ONDRI_data$X, toy_ONDRI_data$Y, bg = ondri_palette("cohorts")[as.character(toy_ONDRI_data$COHORT)], pch = 21)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.