#' DELFI Diagnostics visual identity ggplot2 theme
#'
#'
#' @param base_size (int) Base size for theme, default is 8
#' @param italicize_strip (bool) Italicize strip titles (for gene names), default is FALSE
#' @param gotham_font (bool) Use Gotham font family, default is TRUEuse
#' @importFrom ggplot2 theme theme_classic element_line element_rect element_text element_blank
#' @importFrom sysfonts font_add
#' @return a ggplot2 theme
#' @export
#' @keywords theme
#' @examples
#' ggplot2::ggplot(data = data.frame(x = c(1, 2), y = c(2, 3), g = c('a', 'b')),
#' mapping = ggplot2::aes(x = x, y = y))+
#' theme_delfi(italicize_strip = TRUE)+
#' ggplot2::geom_point()+
#' ggplot2::facet_grid(ggplot2::vars(g))
theme_delfi<-function(base_size=10, italicize_strip=FALSE, gotham_font=TRUE){
th<-ggplot2::theme_classic(base_size)+ggplot2::theme(line = ggplot2::element_line(lineend = 'round'),
rect = ggplot2::element_blank())
if(italicize_strip){
th<-th+ggplot2::theme(strip.text = ggplot2::element_text(face = 'bold.italic', size = 10))
} else {
th<-th+ggplot2::theme(strip.text = ggplot2::element_text(face = 'bold', size = 10))
}
if(gotham_font){
sysfonts::font_add(family = 'Gotham',
regular = system.file('extdata', 'fonts/Gotham/Gotham_Book.otf', package = 'delfiVisID'),
bold = system.file('extdata', 'fonts/Gotham/Gotham_Bold.otf', package = 'delfiVisID'),
italic = system.file('extdata', 'fonts/Gotham/Gotham_Italic.otf', package = 'delfiVisID'),
bolditalic = system.file('extdata', 'fonts/Gotham/Gotham_ItalicBold.otf', package = 'delfiVisID'))
th<-th+ggplot2::theme(text = ggplot2::element_text(family = 'Gotham'))
}
return(th)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.