Skip to content

Commit

Permalink
Merge pull request #68 from OxfordIHTM/dev
Browse files Browse the repository at this point in the history
create forestploter themes
  • Loading branch information
ernestguevarra authored Mar 17, 2024
2 parents 6e0d2c5 + 9faf18f commit f9eaa4e
Show file tree
Hide file tree
Showing 8 changed files with 778 additions and 114 deletions.
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export(get_oxford_colours)
export(oxford_brewer_palettes)
export(oxford_fonts)
export(oxford_theme_palettes)
export(theme_celebratory_forest)
export(theme_contemporary_forest)
export(theme_corporate_forest)
export(theme_heritage_forest)
export(theme_innovative_forest)
export(theme_oxford)
export(theme_oxford_forest)
importFrom(forestploter,forest_theme)
Expand Down
234 changes: 226 additions & 8 deletions R/oxford_theme_forest.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
#' @param ci_fill Colour fill the point estimation. A vector of colour should be
#' provided for the grouped forest plot. Default to value of `ci_col`.
#' @param refline_col Line colour for the reference line. Default set to
#' *Oxford sienna*.
#' *Oxford red*.
#' @param vertline_col Line colour for the extra vertical line. Default set to
#' *Oxford sienna*.
#' *Oxford ash grey*.
#' @param summary_col Colour for borders of the summary diamond shape. Default
#' set to *Oxford dusk*
#' set to *Oxford ash grey*
#' @param summary_fill Colour for filling the summary diamond shape. Default set
#' to value of `summary_col`.
#' @param footnote_cex Multiplier applied to font size for footnote.
#' @param footnote_fontface The font face for footnote.
#' @param footnote_col Colour of the footnote. Default set to
#' *Oxford sage green*.
#' *Oxford royal blue*.
#' @param title_col Colour of title. Default set to *Oxford blue*
#' @param title_fontfamily Font family of title. Default set to value of
#' `base_family`.
Expand All @@ -36,16 +36,16 @@
#' @rdname theme_forest
#' @export
#'
theme_oxford_forest <- function(base_size = 11,
theme_oxford_forest <- function(base_size = 11.5,
base_family = "Roboto",
ci_col = get_oxford_colour("Oxford blue"),
ci_fill = ci_col,
refline_col = get_oxford_colour("red"),
vertline_col = get_oxford_colour("red"),
vertline_col = get_oxford_colour("ash"),
summary_col = get_oxford_colour("ash"),
summary_fill = summary_col,
footnote_cex = 0.7,
footnote_fontface = "bold",
footnote_fontface = "plain",
footnote_col = get_oxford_colour("royal"),
title_col = get_oxford_colour("Oxford blue"),
title_fontfamily = base_family,
Expand All @@ -56,7 +56,7 @@ theme_oxford_forest <- function(base_size = 11,
base_family = base_family,
ci_col = ci_col,
ci_fill = ci_fill,
refline_lwd = 1.5,
refline_lwd = 1.25,
refline_col = refline_col,
vertline_col = vertline_col,
summary_col = summary_col,
Expand All @@ -72,3 +72,221 @@ theme_oxford_forest <- function(base_size = 11,
)
}


#'
#' @rdname theme_forest
#' @export
#'
#'

theme_heritage_forest <- function(base_size = 11,
base_family = "Marcellus",
ci_col = get_oxford_colour("Oxford blue"),
ci_fill = ci_col,
refline_col = get_oxford_colour("sienna"),
vertline_col = get_oxford_colour("peach"),
summary_col = get_oxford_colour("green"),
summary_fill = summary_col,
footnote_cex = 0.8,
footnote_fontface = "plain",
footnote_col = get_oxford_colour("green"),
title_col = get_oxford_colour("Oxford blue"),
title_fontfamily = base_family,
arrow_fill = get_oxford_colour("Oxford blue"),
arrow_col = arrow_fill) {
forestploter::forest_theme(
base_size = base_size,
base_family = base_family,
ci_col = ci_col,
ci_fill = ci_fill,
refline_lwd = 1.25,
refline_col = refline_col,
vertline_col = vertline_col,
summary_col = summary_col,
summary_fill = summary_fill,
footnote_cex = footnote_cex,
footnote_fontface = footnote_fontface,
footnote_col = footnote_col,
title_col = title_col,
title_fontfamily = title_fontfamily,
arrow_fill = arrow_fill,
arrow_col = arrow_col,
arrow_lwd = 1.25
)
}


#'
#' @rdname theme_forest
#' @export
#'
#'

theme_contemporary_forest <- function(base_size = 10.5,
base_family = "Montserrat",
ci_col = get_oxford_colour("Oxford blue"),
ci_fill = ci_col,
refline_col = get_oxford_colour("coral"),
vertline_col = get_oxford_colour("potters"),
summary_col = get_oxford_colour("aqua"),
summary_fill = summary_col,
footnote_cex = 0.7,
footnote_fontface = "plain",
footnote_col = get_oxford_colour("aqua"),
title_col = get_oxford_colour("Oxford blue"),
title_fontfamily = base_family,
arrow_fill = get_oxford_colour("Oxford blue"),
arrow_col = arrow_fill) {
forestploter::forest_theme(
base_size = base_size,
base_family = base_family,
ci_col = ci_col,
ci_fill = ci_fill,
refline_lwd = 1.25,
refline_col = refline_col,
vertline_col = vertline_col,
summary_col = summary_col,
summary_fill = summary_fill,
footnote_cex = footnote_cex,
footnote_fontface = footnote_fontface,
footnote_col = footnote_col,
title_col = title_col,
title_fontfamily = title_fontfamily,
arrow_fill = arrow_fill,
arrow_col = arrow_col,
arrow_lwd = 1.25
)
}


#'
#' @rdname theme_forest
#' @export
#'
#'

theme_celebratory_forest <- function(base_size = 10.5,
base_family = "Noto Serif Display",
ci_col = get_oxford_colour("Oxford blue"),
ci_fill = ci_col,
refline_col = get_oxford_colour("plum"),
vertline_col = get_oxford_colour("mauve"),
summary_col = get_oxford_colour("viridian"),
summary_fill = summary_col,
footnote_cex = 0.7,
footnote_fontface = "plain",
footnote_col = get_oxford_colour("viridian"),
title_col = get_oxford_colour("Oxford blue"),
title_fontfamily = base_family,
arrow_fill = get_oxford_colour("Oxford blue"),
arrow_col = arrow_fill) {
forestploter::forest_theme(
base_size = base_size,
base_family = base_family,
ci_col = ci_col,
ci_fill = ci_fill,
refline_lwd = 1.25,
refline_col = refline_col,
vertline_col = vertline_col,
summary_col = summary_col,
summary_fill = summary_fill,
footnote_cex = footnote_cex,
footnote_fontface = footnote_fontface,
footnote_col = footnote_col,
title_col = title_col,
title_fontfamily = title_fontfamily,
arrow_fill = arrow_fill,
arrow_col = arrow_col,
arrow_lwd = 1.25
)
}


#'
#' @rdname theme_forest
#' @export
#'
#'

theme_corporate_forest <- function(base_size = 10.5,
base_family = "Bebas Neue",
ci_col = get_oxford_colour("Oxford blue"),
ci_fill = ci_col,
refline_col = get_oxford_colour("orange"),
vertline_col = get_oxford_colour("sky"),
summary_col = get_oxford_colour("royal"),
summary_fill = summary_col,
footnote_cex = 0.7,
footnote_fontface = "plain",
footnote_col = get_oxford_colour("royal"),
title_col = get_oxford_colour("Oxford blue"),
title_fontfamily = base_family,
arrow_fill = get_oxford_colour("Oxford blue"),
arrow_col = arrow_fill) {
forestploter::forest_theme(
base_size = base_size,
base_family = base_family,
ci_col = ci_col,
ci_fill = ci_fill,
refline_lwd = 1.25,
refline_col = refline_col,
vertline_col = vertline_col,
summary_col = summary_col,
summary_fill = summary_fill,
footnote_cex = footnote_cex,
footnote_fontface = footnote_fontface,
footnote_col = footnote_col,
title_col = title_col,
title_fontfamily = title_fontfamily,
arrow_fill = arrow_fill,
arrow_col = arrow_col,
arrow_lwd = 1.25
)
}


#'
#' @rdname theme_forest
#' @export
#'
#'

theme_innovative_forest <- function(base_size = 10.5,
base_family = "Phudu",
ci_col = get_oxford_colour("Oxford blue"),
ci_fill = ci_col,
refline_col = get_oxford_colour("Oxford pink"),
vertline_col = get_oxford_colour("vivid"),
summary_col = get_oxford_colour("viridian"),
summary_fill = summary_col,
footnote_cex = 0.7,
footnote_fontface = "plain",
footnote_col = get_oxford_colour("viridian"),
title_col = get_oxford_colour("Oxford blue"),
title_fontfamily = base_family,
arrow_fill = get_oxford_colour("Oxford blue"),
arrow_col = arrow_fill) {
forestploter::forest_theme(
base_size = base_size,
base_family = base_family,
ci_col = ci_col,
ci_fill = ci_fill,
refline_lwd = 1.25,
refline_col = refline_col,
vertline_col = vertline_col,
summary_col = summary_col,
summary_fill = summary_fill,
footnote_cex = footnote_cex,
footnote_fontface = footnote_fontface,
footnote_col = footnote_col,
title_col = title_col,
title_fontfamily = title_fontfamily,
arrow_fill = arrow_fill,
arrow_col = arrow_col,
arrow_lwd = 1.25
)
}




1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ bl
cmyk
dia
fev
forestploter
gam
ggplot
hrbrthemes
Expand Down
Loading

0 comments on commit f9eaa4e

Please sign in to comment.