diff --git a/R/theme-elements.R b/R/theme-elements.R index 947e4e0af3..06f1d9fd37 100644 --- a/R/theme-elements.R +++ b/R/theme-elements.R @@ -14,8 +14,10 @@ #' `margin()`, `margin_part()` and `margin_auto()` are all used to specify the #' margins of elements. #' -#' @param fill Fill colour. +#' @param fill Fill colour. `fill_alpha()` can be used to set the transparency +#' of the fill. #' @param colour,color Line/border colour. Color is an alias for colour. +#' `alpha()` can be used to set the transparency of the colour. #' @param linewidth,borderwidth Line/border size in mm. #' @param size,fontsize text size in pts. #' @param arrow.fill Fill colour for arrows. @@ -26,17 +28,21 @@ #' calculating final element state. #' @return An S3 object of class `element`, `rel`, or `margin`. #' @examples +#' # A standard plot #' plot <- ggplot(mpg, aes(displ, hwy)) + geom_point() #' +#' # Turning off theme elements by setting them to blank #' plot + theme( #' panel.background = element_blank(), #' axis.text = element_blank() #' ) #' +#' # Text adjustments #' plot + theme( #' axis.text = element_text(colour = "red", size = rel(1.5)) #' ) #' +#' # Turning on the axis line with an arrow #' plot + theme( #' axis.line = element_line(arrow = arrow()) #' ) diff --git a/man/element.Rd b/man/element.Rd index c43fadfed2..041bf794f5 100644 --- a/man/element.Rd +++ b/man/element.Rd @@ -74,9 +74,11 @@ margin_part(t = NA, r = NA, b = NA, l = NA, unit = "pt") margin_auto(t = 0, r = t, b = t, l = r, unit = "pt") } \arguments{ -\item{fill}{Fill colour.} +\item{fill}{Fill colour. \code{fill_alpha()} can be used to set the transparency +of the fill.} -\item{colour, color}{Line/border colour. Color is an alias for colour.} +\item{colour, color}{Line/border colour. Color is an alias for colour. +\code{alpha()} can be used to set the transparency of the colour.} \item{linewidth, borderwidth}{Line/border size in mm.} @@ -155,17 +157,21 @@ specify the display of how non-data components of the plot are drawn. margins of elements. } \examples{ +# A standard plot plot <- ggplot(mpg, aes(displ, hwy)) + geom_point() +# Turning off theme elements by setting them to blank plot + theme( panel.background = element_blank(), axis.text = element_blank() ) +# Text adjustments plot + theme( axis.text = element_text(colour = "red", size = rel(1.5)) ) +# Turning on the axis line with an arrow plot + theme( axis.line = element_line(arrow = arrow()) )