diff --git a/NEWS.md b/NEWS.md index 5d171f9..50e3ee4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ * Improved `ticks_digits` auto calculation. * Remove self righteousness cell height adjustment. +* Able to change the fontsize and alignment of the `xlab`. +* Miss seplled `backgroud` parameter in `add_grob`. # forestploter 1.1.0 diff --git a/R/theme.R b/R/theme.R index c657132..c610dcd 100644 --- a/R/theme.R +++ b/R/theme.R @@ -75,7 +75,7 @@ #' @param arrow_fill Filling color of the arrow head, default is \code{"black"}. #' @param arrow_col Line and text color of the arrow, same as \code{arrow_fill} by default. #' @param arrow_cex Multiplier applied to font size for arrow label, same as \code{xaxis_cex} by default. -#' @param xlab_just Control the alignment of xlab to reference line (default) or center of the x-axis. +#' @param xlab_adjust Control the alignment of xlab to reference line (default) or center of the x-axis. #' @param xlab_cex Multiplier applied to font size for xlab #' @param xlab_fontface The font face for xlab, default is \code{'bold'}. #' @param ... Other parameters passed to table. See \code{\link[gridExtra]{tableGrob}} diff --git a/man/forest_theme.Rd b/man/forest_theme.Rd index 24b0b17..d1e98b0 100644 --- a/man/forest_theme.Rd +++ b/man/forest_theme.Rd @@ -42,6 +42,9 @@ forest_theme( arrow_fill = "black", arrow_col = arrow_fill, arrow_cex = xaxis_cex, + xlab_adjust = c("refline", "center"), + xlab_cex = 1, + xlab_fontface = "plain", ... ) } @@ -138,6 +141,12 @@ See \code{\link[grid]{arrow}}.} \item{arrow_cex}{Multiplier applied to font size for arrow label, same as \code{xaxis_cex} by default.} +\item{xlab_adjust}{Control the alignment of xlab to reference line (default) or center of the x-axis.} + +\item{xlab_cex}{Multiplier applied to font size for xlab} + +\item{xlab_fontface}{The font face for xlab, default is \code{'bold'}.} + \item{...}{Other parameters passed to table. See \code{\link[gridExtra]{tableGrob}} for details.} } diff --git a/man/forestploter.Rd b/man/forestploter.Rd index d4d071f..ae83b80 100644 --- a/man/forestploter.Rd +++ b/man/forestploter.Rd @@ -3,6 +3,7 @@ \docType{package} \name{forestploter} \alias{forestploter} +\alias{forestploter-package} \title{Create Forest Plot} \description{ This package uses gtable and gridExtra to overlay forest plots. diff --git a/man/make_xaxis.Rd b/man/make_xaxis.Rd index c4a63b4..561cc8d 100644 --- a/man/make_xaxis.Rd +++ b/man/make_xaxis.Rd @@ -11,6 +11,7 @@ make_xaxis( x_trans = "none", ticks_digits = 1, gp = gpar(), + xlab_gp = NULL, xlim ) } @@ -38,6 +39,8 @@ the trailing zero after the decimal mark.} \item{gp}{Graphical parameters for arrow.} +\item{xlab_gp}{Graphical parameters for xlab.} + \item{xlim}{Limits for the x axis as a vector of length 2, i.e. c(low, high). It will take the minimum and maximum of the lower and upper value if not provided. This will apply to all CI columns if provided, and will be calculated automatically diff --git a/tests/testthat/Rplots.pdf b/tests/testthat/Rplots.pdf index d249693..d4a3f32 100644 Binary files a/tests/testthat/Rplots.pdf and b/tests/testthat/Rplots.pdf differ diff --git a/tests/testthat/test-theme.R b/tests/testthat/test-theme.R index 1e1e2c0..15eaa22 100644 --- a/tests/testthat/test-theme.R +++ b/tests/testthat/test-theme.R @@ -4,8 +4,8 @@ test_that("Test themes default value", { tm <- forest_theme() expect_type(tm, "list") expect_equal(names(tm), c('legend', 'ci', 'xaxis', 'footnote', "title", - 'arrow', 'refline', 'vertline', 'summary', - 'tab_theme')) + 'arrow', 'refline', 'vertline', 'xlab', + 'summary', 'tab_theme')) expect_identical(tm$legend, list(gp = gpar(fontsize = 12, fontfamily = ""), 'name' = "Group", 'position' = "right",