#' Get custom ggplot theme
#'
#' @param base.size base size
#'
#' @importFrom ggplot2 theme_grey
#' @importFrom ggplot2 theme
#' @importFrom ggplot2 element_text
#' @importFrom ggplot2 element_blank
#' @importFrom ggplot2 rel
#' @importFrom ggplot2 margin
#'
#' @return ggtheme object
#' @export
getGGTheme <- function(base.size = 11) {
half.line <- base.size / 2
theme <- theme_grey() + theme(
plot.title = element_text(size = rel(1), hjust = 0, vjust = 1,
face = "bold.italic",
margin = margin(b = half.line * 1)),
plot.subtitle = element_text(size = rel(0.8), hjust = 0, vjust = 1,
margin = margin(b = half.line * 0.8)),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
legend.position = c(0.95, 0.1),
legend.text = element_text(size = 6),
legend.title = element_blank(),
legend.margin = margin(0, 5, 4, 4)
)
return(theme)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.