😎 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.

99 lines
3.8KB

  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. Provides a base plot theme for \link{ggplot2} to match the \link{xaringan} slide theme
  46. created by \link{xaringanthemer}. The theme is designed to create a general plot
  47. style from two colors, a \code{background_color} and a \code{text_color} (or foreground
  48. color). Also accepts an \code{accent_color} and an \code{accent_secondary_color} that are
  49. \link{xaringanthemer} is not required for the base theme. Use
  50. \code{\link[=theme_xaringan]{theme_xaringan()}} or \code{\link[=theme_xaringan_inverse]{theme_xaringan_inverse()}} in xaringan slides styled by
  51. xaringanthemer for a plot theme that matches the slide style.
  52. }
  53. \examples{
  54. if (requireNamespace("ggplot2", quietly = TRUE)) {
  55. library(ggplot2)
  56. ggplot(iris) +
  57. aes(Petal.Length, Petal.Width) +
  58. geom_point() +
  59. theme_xaringan_base(
  60. text_color = "#e1e5f2",
  61. background_color = "#021c25",
  62. accent_color = "#1f7a8c",
  63. set_ggplot_defaults = TRUE) +
  64. labs(title = "Basic Iris Plot",
  65. subtitle = "+ theme_xaringan_base()",
  66. caption = "{xaringanthemer}")
  67. ggplot(iris) +
  68. aes(Petal.Length, Petal.Width) +
  69. geom_point() +
  70. theme_xaringan_base(
  71. text_color = "#021c25",
  72. background_color = "#e1e5f2",
  73. accent_color = "#1f7a8c",
  74. set_ggplot_defaults = TRUE) +
  75. labs(title = "Basic Iris Plot",
  76. subtitle = "+ theme_xaringan_base()",
  77. caption = "{xaringanthemer}")
  78. }
  79. }
  80. \seealso{
  81. Other xaringanthemer ggplot2 themes: \code{\link{theme_xaringan_inverse}},
  82. \code{\link{theme_xaringan_set_defaults}},
  83. \code{\link{theme_xaringan}}
  84. }
  85. \concept{xaringanthemer ggplot2 themes}