😎 Give your xaringan slides some style
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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