😎 Give your xaringan slides some style
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

115 líneas
3.9KB

  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/ggplot2.R
  3. \name{theme_xaringan_base}
  4. \alias{theme_xaringan_base}
  5. \title{The ggplot2 xaringanthemer base plot theme}
  6. \usage{
  7. theme_xaringan_base(
  8. text_color,
  9. background_color,
  10. ...,
  11. set_ggplot_defaults = TRUE,
  12. accent_color = NULL,
  13. accent_secondary_color = NULL,
  14. text_font = NULL,
  15. text_font_use_google = NULL,
  16. text_font_size = NULL,
  17. title_font = NULL,
  18. title_font_use_google = NULL,
  19. title_font_size = NULL
  20. )
  21. }
  22. \arguments{
  23. \item{text_color}{Color for text and foreground}
  24. \item{background_color}{Color for background}
  25. \item{...}{Ignored}
  26. \item{set_ggplot_defaults}{Should defaults be set for \pkg{ggplot2} \emph{geoms}?
  27. Defaults to TRUE. To restore ggplot's defaults, or the previously set geom
  28. defaults, see \code{\link[=theme_xaringan_restore_defaults]{theme_xaringan_restore_defaults()}}.}
  29. \item{accent_color}{Color for titles and accents, inherits from
  30. \code{header_color} or \code{text_color}. Used for the \code{title} base setting in
  31. \code{\link[ggplot2:theme]{ggplot2::theme()}}, and additionally for setting the \code{color} or \code{fill} of
  32. \pkg{ggplot2} geom defaults.}
  33. \item{accent_secondary_color}{Color for secondary accents, inherits from
  34. \code{text_bold_color} or \code{accent_color}. Used only when setting \pkg{ggplot2} geom
  35. defaults.}
  36. \item{text_font}{Font to use for text elements, passed to
  37. \code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{text_font_use_google} is
  38. \code{TRUE}. Inherits from \code{text_font_family}.}
  39. \item{text_font_use_google}{Is \code{text_font} available on \href{https://fonts.google.com}{Google Fonts}?}
  40. \item{text_font_size}{Base text font size, inherits from \code{text_font_size}, or
  41. defaults to 11.}
  42. \item{title_font}{Font to use for title elements, passed to
  43. \code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{title_font_use_google} is
  44. \code{TRUE}. Inherits from \code{title_font_family}.}
  45. \item{title_font_use_google}{Is \code{title_font} available on \href{https://fonts.google.com}{Google Fonts}?}
  46. \item{title_font_size}{Base text font size, inherits from \code{title_font_size},
  47. or defaults to 14.}
  48. }
  49. \value{
  50. A ggplot2 theme
  51. }
  52. \description{
  53. \strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#experimental}{Experimental}.
  54. Provides a base plot theme for \pkg{ggplot2} to match the \pkg{xaringan} slide theme
  55. created by \link{xaringanthemer}. The theme is designed to create a general plot
  56. style from two colors, a \code{background_color} and a \code{text_color} (or foreground
  57. color). Also accepts an \code{accent_color} and an \code{accent_secondary_color} that are
  58. \link{xaringanthemer} is not required for the base theme. Use
  59. \code{\link[=theme_xaringan]{theme_xaringan()}} or \code{\link[=theme_xaringan_inverse]{theme_xaringan_inverse()}} in xaringan slides styled by
  60. xaringanthemer for a plot theme that matches the slide style.
  61. }
  62. \examples{
  63. if (requireNamespace("ggplot2", quietly = TRUE)) {
  64. library(ggplot2)
  65. ggplot(iris) +
  66. aes(Petal.Length, Petal.Width) +
  67. geom_point() +
  68. theme_xaringan_base(
  69. text_color = "#e1e5f2",
  70. background_color = "#021c25",
  71. accent_color = "#1f7a8c",
  72. set_ggplot_defaults = TRUE
  73. ) +
  74. labs(
  75. title = "Basic Iris Plot",
  76. subtitle = "+ theme_xaringan_base()",
  77. caption = "{xaringanthemer}"
  78. )
  79. ggplot(iris) +
  80. aes(Petal.Length, Petal.Width) +
  81. geom_point() +
  82. theme_xaringan_base(
  83. text_color = "#021c25",
  84. background_color = "#e1e5f2",
  85. accent_color = "#1f7a8c",
  86. set_ggplot_defaults = TRUE
  87. ) +
  88. labs(
  89. title = "Basic Iris Plot",
  90. subtitle = "+ theme_xaringan_base()",
  91. caption = "{xaringanthemer}"
  92. )
  93. }
  94. }
  95. \seealso{
  96. Other xaringanthemer ggplot2 themes:
  97. \code{\link{theme_xaringan_inverse}()},
  98. \code{\link{theme_xaringan_set_defaults}()},
  99. \code{\link{theme_xaringan}()}
  100. }
  101. \concept{xaringanthemer ggplot2 themes}