# function to generate random colours from the brewer palettes.
random_palette <- function(n){
# idea from here: https://stackoverflow.com/questions/15282580/how-to-generate-a-number-of-most-distinctive-colors-in-r
qual_col_pals = RColorBrewer::brewer.pal.info[RColorBrewer::brewer.pal.info$category == 'qual',]
col_vector = unlist(mapply(RColorBrewer::brewer.pal, qual_col_pals$maxcolors, rownames(qual_col_pals)))
sample(col_vector, n, replace = T)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.