#' Color palette list for ebmvm
#'#'
#' @details 'Ordem' Color Palette based on the colors of the Brazilian Flag
#'
#' @examples
#' \dontrun{
#' library(ggplot2)
#' df <- data.frame(x=seq(1,n,1),
#' y = seq(1,n,1),
#' z = seq(1,n,1))
#' ggplot(df, aes(x=x,y=y,fill=z))+
#' geom_col()+
#' scale_fill_gradientn(colours = ebvm.pal(6,'Ordem'))
#'}
#'
#' @export
divlist <- c("Ordem")
names(divlist) <- divlist
quallist <- c()
names(quallist) <- quallist
seqlist <- c()
names(seqlist) <- seqlist
divnum <- rep(11, length(divlist))
names(divnum) <- divlist
qualnum <- c()
names(qualnum) <- quallist
seqnum <- c()
names(seqnum) <- seqlist
namelist<-c(divlist,quallist,seqlist)
maxcolors <- c(divnum,qualnum,seqnum)
catlist<-rep(c("div","qual","seq"),c(length(divlist),length(quallist),length(seqlist)))
brewer.pal.info<-data.frame(maxcolors=maxcolors,
category=catlist,
row.names=namelist)
ebvm.pal <- function(n, name){
if(!(name %in% namelist)){
stop(paste(name, "is not a valid palette name for ebvm.pal\n"))
}
if(n<3){
warning('minimal value for n is 3, returning requested palette with 3 different levels\n')
return(ebvm.pal(3, name))
}
if(n > maxcolors[which(name == namelist)]){
warning(paste("n too large, allowed maximum for palette", name, "is", maxcolors[which(name==namelist)]),
"\nReturning the palette you asked for with that many colors\n")
return(ebvm.pal(maxcolors[which(name==namelist)],name))
}
switch(name,
Ordem = switch(n-2,
rgb(c(238, 34, 54),
c(201, 139, 100),
c(0, 34, 139), maxColorValue=255),
rgb(c(238, 102, 40, 54),
c(201, 159, 125, 100),
c(0, 22, 68, 139), maxColorValue=255),
rgb(c(238, 136, 34, 44, 54),
c(201, 170, 139, 119, 100),
c(0, 17, 34, 86, 139), maxColorValue=255),
rgb(c(238, 156, 74, 38, 46, 54),
c(201, 176, 151, 131, 115, 100),
c(0, 13, 27, 55, 97, 139) ,maxColorValue=255),
rgb(c(238, 170, 102, 34, 40, 47, 54),
c(201, 180, 159, 139, 125, 113, 100),
c(0, 11, 22, 34, 68, 103, 139),maxColorValue=255),
rgb(c(238, 179, 121, 63, 36, 42, 48, 54),
c(201, 183, 165, 147, 133, 122, 111, 100),
c(0, 9, 19, 29, 48, 78, 108, 139),maxColorValue=255),
rgb(c(238, 187, 136, 84, 34, 39, 44, 48, 54),
c(201, 185, 170, 154, 139, 129, 119, 109, 100),
c(0, 8, 17, 25, 34, 60, 86, 112, 139),maxColorValue=255),
rgb(cc(238, 192, 147, 102, 56, 36, 40, 45, 49, 54),
c(201, 187, 173, 159, 145, 134, 125, 117, 108, 100),
c(0, 7, 15, 22, 30, 45, 68, 92, 115, 139),maxColorValue=255),
rgb(c(238, 197, 156, 115, 74, 34, 38, 42, 46, 50, 54),
c(201, 188, 176, 163, 151, 139, 131, 123, 115, 107, 100),
c(0, 6, 13, 20, 27, 34, 55, 76, 97, 118, 139),maxColorValue=255)
))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.