Преглед изворни кода

Don't rely on dot passing for theme_xarinan* functions

tags/v0.3.0
Garrick Aden-Buie пре 6 година
родитељ
комит
9fefdf5814
3 измењених фајлова са 80 додато и 32 уклоњено
  1. +34
    -6
      R/ggplot2.R
  2. +23
    -13
      man/theme_xaringan.Rd
  3. +23
    -13
      man/theme_xaringan_inverse.Rd

+ 34
- 6
R/ggplot2.R Прегледај датотеку

#' lets you create a \pkg{ggplot2} theme for your \pkg{xaringan} slides, even #' lets you create a \pkg{ggplot2} theme for your \pkg{xaringan} slides, even
#' if you have only saved your theme CSS file and you aren't creating your #' if you have only saved your theme CSS file and you aren't creating your
#' CSS theme with \pkg{xaringanthemer} in your slides' source file. #' CSS theme with \pkg{xaringanthemer} in your slides' source file.
#' @inheritDotParams theme_xaringan_base
#' @inheritParams theme_xaringan_base
#' #'
#' @examples #' @examples
#' # Requires ggplot2 #' # Requires ggplot2
accent_color = NULL, accent_color = NULL,
accent_secondary_color = NULL, accent_secondary_color = NULL,
css_file = NULL, css_file = NULL,
...
set_ggplot_defaults = TRUE,
text_font = NULL,
text_font_use_google = NULL,
text_font_size = NULL,
title_font = NULL,
title_font_use_google = NULL,
title_font_size = NULL,
use_showtext = TRUE
) { ) {
requires_xaringanthemer_env(css_file = css_file, try_css = TRUE) requires_xaringanthemer_env(css_file = css_file, try_css = TRUE)
requires_package(fn = "xaringan_theme") requires_package(fn = "xaringan_theme")
background_color, background_color,
accent_color = accent_color, accent_color = accent_color,
accent_secondary_color = accent_secondary_color, accent_secondary_color = accent_secondary_color,
...
set_ggplot_defaults = set_ggplot_defaults,
text_font = text_font,
text_font_use_google = text_font_use_google,
text_font_size = text_font_size,
title_font = title_font,
title_font_use_google = title_font_use_google,
title_font_size = title_font_size,
use_showtext = use_showtext
) )
} }


#' @param accent_secondary_color Color for secondary accents, inherits from #' @param accent_secondary_color Color for secondary accents, inherits from
#' `text_bold_color` #' `text_bold_color`
#' @inheritParams theme_xaringan #' @inheritParams theme_xaringan
#' @inheritDotParams theme_xaringan_base
#' @inheritParams theme_xaringan_base
#' #'
#' @examples #' @examples
#' # Requires ggplot2 #' # Requires ggplot2
accent_color = NULL, accent_color = NULL,
accent_secondary_color = NULL, accent_secondary_color = NULL,
css_file = NULL, css_file = NULL,
...
set_ggplot_defaults = TRUE,
text_font = NULL,
text_font_use_google = NULL,
text_font_size = NULL,
title_font = NULL,
title_font_use_google = NULL,
title_font_size = NULL,
use_showtext = TRUE
) { ) {
requires_xaringanthemer_env(css_file = css_file, try_css = TRUE) requires_xaringanthemer_env(css_file = css_file, try_css = TRUE)
requires_package(fn = "xaringan_theme") requires_package(fn = "xaringan_theme")
background_color, background_color,
accent_color = accent_color, accent_color = accent_color,
accent_secondary_color = accent_secondary_color, accent_secondary_color = accent_secondary_color,
...
set_ggplot_defaults = set_ggplot_defaults,
text_font = text_font,
text_font_use_google = text_font_use_google,
text_font_size = text_font_size,
title_font = title_font,
title_font_use_google = title_font_use_google,
title_font_size = title_font_size,
use_showtext = use_showtext
) )
} }



+ 23
- 13
man/theme_xaringan.Rd Прегледај датотеку

accent_color = NULL, accent_color = NULL,
accent_secondary_color = NULL, accent_secondary_color = NULL,
css_file = NULL, css_file = NULL,
...
set_ggplot_defaults = TRUE,
text_font = NULL,
text_font_use_google = NULL,
text_font_size = NULL,
title_font = NULL,
title_font_use_google = NULL,
title_font_size = NULL,
use_showtext = TRUE
) )
} }
\arguments{ \arguments{
if you have only saved your theme CSS file and you aren't creating your if you have only saved your theme CSS file and you aren't creating your
CSS theme with \pkg{xaringanthemer} in your slides' source file.} CSS theme with \pkg{xaringanthemer} in your slides' source file.}


\item{...}{
Arguments passed on to \code{\link[=theme_xaringan_base]{theme_xaringan_base}}
\describe{
\item{\code{set_ggplot_defaults}}{Should defaults be set for \pkg{ggplot2} \emph{geoms}?
\item{set_ggplot_defaults}{Should defaults be set for \pkg{ggplot2} \emph{geoms}?
Defaults to TRUE. To restore ggplot's defaults, or the previously set geom Defaults to TRUE. To restore ggplot's defaults, or the previously set geom
defaults, see \code{\link[=theme_xaringan_restore_defaults]{theme_xaringan_restore_defaults()}}.} defaults, see \code{\link[=theme_xaringan_restore_defaults]{theme_xaringan_restore_defaults()}}.}
\item{\code{text_font}}{Font to use for text elements, passed to

\item{text_font}{Font to use for text elements, passed to
\code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{text_font_use_google} is \code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{text_font_use_google} is
\code{TRUE}. Inherits from \code{text_font_family}.} \code{TRUE}. Inherits from \code{text_font_family}.}
\item{\code{text_font_use_google}}{Is \code{text_font} available on \href{https://fonts.google.com}{Google Fonts}?}
\item{\code{text_font_size}}{Base text font size, inherits from \code{text_font_size}, or

\item{text_font_use_google}{Is \code{text_font} available on \href{https://fonts.google.com}{Google Fonts}?}

\item{text_font_size}{Base text font size, inherits from \code{text_font_size}, or
defaults to 11.} defaults to 11.}
\item{\code{title_font}}{Font to use for title elements, passed to

\item{title_font}{Font to use for title elements, passed to
\code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{title_font_use_google} is \code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{title_font_use_google} is
\code{TRUE}. Inherits from \code{title_font_family}.} \code{TRUE}. Inherits from \code{title_font_family}.}
\item{\code{title_font_use_google}}{Is \code{title_font} available on \href{https://fonts.google.com}{Google Fonts}?}
\item{\code{title_font_size}}{Base text font size, inherits from \code{title_font_size},

\item{title_font_use_google}{Is \code{title_font} available on \href{https://fonts.google.com}{Google Fonts}?}

\item{title_font_size}{Base text font size, inherits from \code{title_font_size},
or defaults to 14.} or defaults to 14.}
\item{\code{use_showtext}}{If \code{TRUE} (default) the \pkg{showtext} package will be

\item{use_showtext}{If \code{TRUE} (default) the \pkg{showtext} package will be
used to register Google fonts. Set to \code{FALSE} to disable this feature used to register Google fonts. Set to \code{FALSE} to disable this feature
entirely, which may result in errors during plotting if the fonts used are entirely, which may result in errors during plotting if the fonts used are
not available locally.} not available locally.}
}}
} }
\value{ \value{
A ggplot2 theme A ggplot2 theme

+ 23
- 13
man/theme_xaringan_inverse.Rd Прегледај датотеку

accent_color = NULL, accent_color = NULL,
accent_secondary_color = NULL, accent_secondary_color = NULL,
css_file = NULL, css_file = NULL,
...
set_ggplot_defaults = TRUE,
text_font = NULL,
text_font_use_google = NULL,
text_font_size = NULL,
title_font = NULL,
title_font_use_google = NULL,
title_font_size = NULL,
use_showtext = TRUE
) )
} }
\arguments{ \arguments{
if you have only saved your theme CSS file and you aren't creating your if you have only saved your theme CSS file and you aren't creating your
CSS theme with \pkg{xaringanthemer} in your slides' source file.} CSS theme with \pkg{xaringanthemer} in your slides' source file.}


\item{...}{
Arguments passed on to \code{\link[=theme_xaringan_base]{theme_xaringan_base}}
\describe{
\item{\code{set_ggplot_defaults}}{Should defaults be set for \pkg{ggplot2} \emph{geoms}?
\item{set_ggplot_defaults}{Should defaults be set for \pkg{ggplot2} \emph{geoms}?
Defaults to TRUE. To restore ggplot's defaults, or the previously set geom Defaults to TRUE. To restore ggplot's defaults, or the previously set geom
defaults, see \code{\link[=theme_xaringan_restore_defaults]{theme_xaringan_restore_defaults()}}.} defaults, see \code{\link[=theme_xaringan_restore_defaults]{theme_xaringan_restore_defaults()}}.}
\item{\code{text_font}}{Font to use for text elements, passed to

\item{text_font}{Font to use for text elements, passed to
\code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{text_font_use_google} is \code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{text_font_use_google} is
\code{TRUE}. Inherits from \code{text_font_family}.} \code{TRUE}. Inherits from \code{text_font_family}.}
\item{\code{text_font_use_google}}{Is \code{text_font} available on \href{https://fonts.google.com}{Google Fonts}?}
\item{\code{text_font_size}}{Base text font size, inherits from \code{text_font_size}, or

\item{text_font_use_google}{Is \code{text_font} available on \href{https://fonts.google.com}{Google Fonts}?}

\item{text_font_size}{Base text font size, inherits from \code{text_font_size}, or
defaults to 11.} defaults to 11.}
\item{\code{title_font}}{Font to use for title elements, passed to

\item{title_font}{Font to use for title elements, passed to
\code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{title_font_use_google} is \code{\link[sysfonts:font_add_google]{sysfonts::font_add_google()}}, if available and \code{title_font_use_google} is
\code{TRUE}. Inherits from \code{title_font_family}.} \code{TRUE}. Inherits from \code{title_font_family}.}
\item{\code{title_font_use_google}}{Is \code{title_font} available on \href{https://fonts.google.com}{Google Fonts}?}
\item{\code{title_font_size}}{Base text font size, inherits from \code{title_font_size},

\item{title_font_use_google}{Is \code{title_font} available on \href{https://fonts.google.com}{Google Fonts}?}

\item{title_font_size}{Base text font size, inherits from \code{title_font_size},
or defaults to 14.} or defaults to 14.}
\item{\code{use_showtext}}{If \code{TRUE} (default) the \pkg{showtext} package will be

\item{use_showtext}{If \code{TRUE} (default) the \pkg{showtext} package will be
used to register Google fonts. Set to \code{FALSE} to disable this feature used to register Google fonts. Set to \code{FALSE} to disable this feature
entirely, which may result in errors during plotting if the fonts used are entirely, which may result in errors during plotting if the fonts used are
not available locally.} not available locally.}
}}
} }
\value{ \value{
A ggplot2 theme A ggplot2 theme

Loading…
Откажи
Сачувај