😎 Give your xaringan slides some style
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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