diff --git a/R/theme.R b/R/theme.R index 2ae9a7b..16d1851 100644 --- a/R/theme.R +++ b/R/theme.R @@ -7,15 +7,15 @@ #' parameters will be passed to corresponding elements of the forest plot. #' #' \itemize{ -#' \item{\code{ci_*}}{Control the graphical parameters of confidence intervals} -#' \item{\code{legend_*}}{Control the graphical parameters of legend} -#' \item{\code{xaxis_*}}{Control the graphical parameters of x-axis} -#' \item{\code{refline_*}}{Control the graphical parameters of reference line} -#' \item{\code{vertline_*}}{Control the graphical parameters of vertical line} -#' \item{\code{summary_*}}{Control the graphical parameters of diamond shaped summary CI} -#' \item{\code{footnote_*}}{Control the graphical parameters of footnote} -#' \item{\code{title_*}}{Control the graphical parameters of title} -#' \item{\code{arrow_*}}{Control the graphical parameters of arrow} +#' \item \code{ci_*} Control the graphical parameters of confidence intervals +#' \item \code{legend_*} Control the graphical parameters of legend +#' \item \code{xaxis_*} Control the graphical parameters of x-axis +#' \item \code{refline_*} Control the graphical parameters of reference line +#' \item \code{vertline_*} Control the graphical parameters of vertical line +#' \item \code{summary_*} Control the graphical parameters of diamond shaped summary CI +#' \item \code{footnote_*} Control the graphical parameters of footnote +#' \item \code{title_*} Control the graphical parameters of title +#' \item \code{arrow_*} Control the graphical parameters of arrow #' } #' #' See \code{\link[grid]{gpar}} for more details. diff --git a/inst/examples/forestplot-example.r b/inst/examples/forestplot-example.r index c4e8dbb..5070a9f 100644 --- a/inst/examples/forestplot-example.r +++ b/inst/examples/forestplot-example.r @@ -1,3 +1,4 @@ +library(grid) # Read provided sample example data dt <- read.csv(system.file("extdata", "example_data.csv", package = "forestploter")) @@ -25,9 +26,8 @@ dt$`HR (95% CI)` <- ifelse(is.na(dt$se), "", # Define theme tm <- forest_theme(base_size = 10, - refline_col = "red", - footnote_col = "#636363", - footnote_fontface = "italic") + refline_gp = gpar(col = "red"), + footnote_gp = gpar(col = "#636363", fontface = "italic")) p <- forest(dt[,c(1:3, 8:9)], est = dt$est, diff --git a/man/forest.Rd b/man/forest.Rd index 6fc10e4..6348afb 100644 --- a/man/forest.Rd +++ b/man/forest.Rd @@ -136,6 +136,7 @@ A data frame will be used for the basic layout of the forest plot. Graphical parameters can be set using the \code{\link{forest_theme}} function. } \examples{ +library(grid) # Read provided sample example data dt <- read.csv(system.file("extdata", "example_data.csv", package = "forestploter")) @@ -163,9 +164,8 @@ dt$`HR (95\% CI)` <- ifelse(is.na(dt$se), "", # Define theme tm <- forest_theme(base_size = 10, - refline_col = "red", - footnote_col = "#636363", - footnote_fontface = "italic") + refline_gp = gpar(col = "red"), + footnote_gp = gpar(col = "#636363", fontface = "italic")) p <- forest(dt[,c(1:3, 8:9)], est = dt$est, diff --git a/man/forest_theme.Rd b/man/forest_theme.Rd index a227e4f..1a57593 100644 --- a/man/forest_theme.Rd +++ b/man/forest_theme.Rd @@ -130,15 +130,15 @@ Default theme for the forest plot, but can pass other parameters. The parameters will be passed to corresponding elements of the forest plot. \itemize{ -\item{\code{ci_*}}{Control the graphical parameters of confidence intervals} -\item{\code{legend_*}}{Control the graphical parameters of legend} -\item{\code{xaxis_*}}{Control the graphical parameters of x-axis} -\item{\code{refline_*}}{Control the graphical parameters of reference line} -\item{\code{vertline_*}}{Control the graphical parameters of vertical line} -\item{\code{summary_*}}{Control the graphical parameters of diamond shaped summary CI} -\item{\code{footnote_*}}{Control the graphical parameters of footnote} -\item{\code{title_*}}{Control the graphical parameters of title} -\item{\code{arrow_*}}{Control the graphical parameters of arrow} +\item \code{ci_*} Control the graphical parameters of confidence intervals +\item \code{legend_*} Control the graphical parameters of legend +\item \code{xaxis_*} Control the graphical parameters of x-axis +\item \code{refline_*} Control the graphical parameters of reference line +\item \code{vertline_*} Control the graphical parameters of vertical line +\item \code{summary_*} Control the graphical parameters of diamond shaped summary CI +\item \code{footnote_*} Control the graphical parameters of footnote +\item \code{title_*} Control the graphical parameters of title +\item \code{arrow_*} Control the graphical parameters of arrow } See \code{\link[grid]{gpar}} for more details. diff --git a/vignettes/forestploter-intro.Rmd b/vignettes/forestploter-intro.Rmd index bc4de7c..ca984a4 100644 --- a/vignettes/forestploter-intro.Rmd +++ b/vignettes/forestploter-intro.Rmd @@ -113,9 +113,7 @@ tm <- forest_theme(base_size = 10, ci_lwd = 1.5, ci_Theight = 0.2, # Set a T end at the end of CI # Reference line width/type/color - refline_lwd = 1, - refline_lty = "dashed", - refline_col = "grey20", + refline_lwd = gpar(lwd = 1, lty = "dashed", col = "grey20"), # Vertical line width/type/color vertline_lwd = 1, vertline_lty = "dashed",