Explorar el Código

mark ggplot2 themes and functions as experimental

tags/v0.3.0
Garrick Aden-Buie hace 6 años
padre
commit
699d107292
Se han modificado 6 ficheros con 58 adiciones y 16 borrados
  1. +34
    -8
      R/ggplot2.R
  2. +2
    -0
      man/scale_xaringan.Rd
  3. +2
    -0
      man/theme_xaringan.Rd
  4. +16
    -8
      man/theme_xaringan_base.Rd
  5. +2
    -0
      man/theme_xaringan_inverse.Rd
  6. +2
    -0
      man/theme_xaringan_set_defaults.Rd

+ 34
- 8
R/ggplot2.R Ver fichero

@@ -1,6 +1,10 @@

#' A Plot Theme for ggplot2 by xaringanthemer
#'
#' @description
#'
#' **Lifecycle:** [Experimental](https://www.tidyverse.org/lifecycle/#experimental).
#'
#' Creates [ggplot2] themes to match the xaringanthemer theme used in the
#' [xaringan] slides that seamlessly matches the "normal" slide colors and
#' styles.
@@ -52,6 +56,10 @@ theme_xaringan <- function(

#' An Inverse Plot Theme for ggplot2 by xaringanthemer
#'
#' @description
#'
#' **Lifecycle:** [Experimental](https://www.tidyverse.org/lifecycle/#experimental).
#'
#' A [ggplot2] xaringanthemer plot theme to seamlessly match the "inverse"
#' [xaringan] slide colors and styles as styled by [xaringanthemer].
#'
@@ -102,6 +110,10 @@ theme_xaringan_inverse <- function(

#' The ggplot2 xaringanthemer base plot theme
#'
#' @description
#'
#' **Lifecycle:** [Experimental](https://www.tidyverse.org/lifecycle/#experimental).
#'
#' Provides a base plot theme for [ggplot2] to match the [xaringan] slide theme
#' created by [xaringanthemer]. The theme is designed to create a general plot
#' style from two colors, a `background_color` and a `text_color` (or foreground
@@ -148,10 +160,13 @@ theme_xaringan_inverse <- function(
#' text_color = "#e1e5f2",
#' background_color = "#021c25",
#' accent_color = "#1f7a8c",
#' set_ggplot_defaults = TRUE) +
#' labs(title = "Basic Iris Plot",
#' subtitle = "+ theme_xaringan_base()",
#' caption = "{xaringanthemer}")
#' set_ggplot_defaults = TRUE
#' ) +
#' labs(
#' title = "Basic Iris Plot",
#' subtitle = "+ theme_xaringan_base()",
#' caption = "{xaringanthemer}"
#' )
#'
#' ggplot(iris) +
#' aes(Petal.Length, Petal.Width) +
@@ -160,10 +175,13 @@ theme_xaringan_inverse <- function(
#' text_color = "#021c25",
#' background_color = "#e1e5f2",
#' accent_color = "#1f7a8c",
#' set_ggplot_defaults = TRUE) +
#' labs(title = "Basic Iris Plot",
#' subtitle = "+ theme_xaringan_base()",
#' caption = "{xaringanthemer}")
#' set_ggplot_defaults = TRUE
#' ) +
#' labs(
#' title = "Basic Iris Plot",
#' subtitle = "+ theme_xaringan_base()",
#' caption = "{xaringanthemer}"
#' )
#' }
#'
#' @return A ggplot2 theme
@@ -239,6 +257,10 @@ theme_xaringan_base <- function(

#' Set and Restore ggplot2 geom Defaults
#'
#' @description
#'
#' **Lifecycle:** [Experimental](https://www.tidyverse.org/lifecycle/#experimental).
#'
#' Set [ggplot2] _geom_ defaults to match [theme_xaringan()] with
#' `theme_xaringan_set_defaults()` and restore the standard or previously-set
#' defaults with `theme_xaringan_restore_defaults()`. By default,
@@ -355,6 +377,10 @@ safely_set_geom <- function(geom, new) {

#' Xaringan Themer ggplot2 Scales
#'
#' @description
#'
#' **Lifecycle:** [Experimental](https://www.tidyverse.org/lifecycle/#experimental).
#'
#' Color and fill single-color scales for discrete and continuous values,
#' created using the primary accent color of the xaringanthemer styles.
#'

+ 2
- 0
man/scale_xaringan.Rd Ver fichero

@@ -65,6 +65,8 @@ value of \code{inverse_header_color}}
\code{\link[=ggplot2:discrete_scale]{ggplot2:discrete_scale()}}.}
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#experimental}{Experimental}.

Color and fill single-color scales for discrete and continuous values,
created using the primary accent color of the xaringanthemer styles.
}

+ 2
- 0
man/theme_xaringan.Rd Ver fichero

@@ -51,6 +51,8 @@ or defaults to 14.}
A ggplot2 theme
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#experimental}{Experimental}.

Creates \link{ggplot2} themes to match the xaringanthemer theme used in the
\link{xaringan} slides that seamlessly matches the "normal" slide colors and
styles.

+ 16
- 8
man/theme_xaringan_base.Rd Ver fichero

@@ -53,6 +53,8 @@ or defaults to 14.}
A ggplot2 theme
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#experimental}{Experimental}.

Provides a base plot theme for \link{ggplot2} to match the \link{xaringan} slide theme
created by \link{xaringanthemer}. The theme is designed to create a general plot
style from two colors, a \code{background_color} and a \code{text_color} (or foreground
@@ -71,10 +73,13 @@ if (requireNamespace("ggplot2", quietly = TRUE)) {
text_color = "#e1e5f2",
background_color = "#021c25",
accent_color = "#1f7a8c",
set_ggplot_defaults = TRUE) +
labs(title = "Basic Iris Plot",
subtitle = "+ theme_xaringan_base()",
caption = "{xaringanthemer}")
set_ggplot_defaults = TRUE
) +
labs(
title = "Basic Iris Plot",
subtitle = "+ theme_xaringan_base()",
caption = "{xaringanthemer}"
)

ggplot(iris) +
aes(Petal.Length, Petal.Width) +
@@ -83,10 +88,13 @@ if (requireNamespace("ggplot2", quietly = TRUE)) {
text_color = "#021c25",
background_color = "#e1e5f2",
accent_color = "#1f7a8c",
set_ggplot_defaults = TRUE) +
labs(title = "Basic Iris Plot",
subtitle = "+ theme_xaringan_base()",
caption = "{xaringanthemer}")
set_ggplot_defaults = TRUE
) +
labs(
title = "Basic Iris Plot",
subtitle = "+ theme_xaringan_base()",
caption = "{xaringanthemer}"
)
}

}

+ 2
- 0
man/theme_xaringan_inverse.Rd Ver fichero

@@ -51,6 +51,8 @@ or defaults to 14.}
A ggplot2 theme
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#experimental}{Experimental}.

A \link{ggplot2} xaringanthemer plot theme to seamlessly match the "inverse"
\link{xaringan} slide colors and styles as styled by \link{xaringanthemer}.
}

+ 2
- 0
man/theme_xaringan_set_defaults.Rd Ver fichero

@@ -29,6 +29,8 @@ Invisibly returns a list of the current ggplot2 geom defaults
Invisibly returns a list of the current ggplot2 geom defaults
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#experimental}{Experimental}.

Set \link{ggplot2} \emph{geom} defaults to match \code{\link[=theme_xaringan]{theme_xaringan()}} with
\code{theme_xaringan_set_defaults()} and restore the standard or previously-set
defaults with \code{theme_xaringan_restore_defaults()}. By default,

Cargando…
Cancelar
Guardar