Просмотр исходного кода

Use logical `NA` that can be cast to character (#82)

* use logical `NA` that can be cast to character

* chore: Use ggplot2's default color scale `na.value`

* chore: document()

* chore: Also set `na.value = "grey50"` in `scale_xaringan_discrete()`.

* chore: Add news item

---------

Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
tags/v0.4.4
Teun van den Brand 11 месяцев назад
Родитель
Сommit
5071cb3d14
Аккаунт пользователя с таким Email не найден
3 измененных файлов: 16 добавлений и 5 удалений
  1. +4
    -0
      NEWS.md
  2. +6
    -3
      R/ggplot2.R
  3. +6
    -2
      man/scale_xaringan.Rd

+ 4
- 0
NEWS.md Просмотреть файл

# xaringanthemer (development version) # xaringanthemer (development version)


- `scale_xaringan_continuous()` and `scale_xaringan_discrete()` now set
`na.value = "grey50"` by default for compatibility with ggplot2 > 3.5.2
(thanks @teunbrand, #82).

# xaringanthemer 0.4.3 # xaringanthemer 0.4.3


- Update the spelling of `colour` for compatibility with ggplot2 >= 3.5.1 (@teunbrand #79). - Update the spelling of `colour` for compatibility with ggplot2 >= 3.5.1 (@teunbrand #79).

+ 6
- 3
R/ggplot2.R Просмотреть файл

..., ...,
color = NULL, color = NULL,
direction = 1, direction = 1,
inverse = FALSE
inverse = FALSE,
na.value = "grey50"
) { ) {
requires_package("ggplot2", "scale_xaringan_discrete") requires_package("ggplot2", "scale_xaringan_discrete")


) )
} }


ggplot2::discrete_scale(aes_type, "manual", pal, ...)
ggplot2::discrete_scale(aes_type, "manual", pal, ..., na.value = na.value)
} }


#' @rdname scale_xaringan #' @rdname scale_xaringan
color = NULL, color = NULL,
begin = 0, begin = 0,
end = 1, end = 1,
inverse = FALSE
inverse = FALSE,
na.value = "grey50"
) { ) {
requires_package("ggplot2", "scale_xaringan_continuous") requires_package("ggplot2", "scale_xaringan_continuous")
requires_package("scales", "scale_xaringan_continuous") requires_package("scales", "scale_xaringan_continuous")
palette = scales::gradient_n_pal(colors, values = NULL), palette = scales::gradient_n_pal(colors, values = NULL),
rescaler = rescaler, rescaler = rescaler,
oob = scales::censor, oob = scales::censor,
na.value = na.value,
... ...
) )
} }

+ 6
- 2
man/scale_xaringan.Rd Просмотреть файл

..., ...,
color = NULL, color = NULL,
direction = 1, direction = 1,
inverse = FALSE
inverse = FALSE,
na.value = "grey50"
) )


scale_xaringan_fill_discrete(..., color = NULL, direction = 1, inverse = FALSE) scale_xaringan_fill_discrete(..., color = NULL, direction = 1, inverse = FALSE)
color = NULL, color = NULL,
begin = 0, begin = 0,
end = 1, end = 1,
inverse = FALSE
inverse = FALSE,
na.value = "grey50"
) )


scale_xaringan_fill_continuous( scale_xaringan_fill_continuous(
color is chosen to work well with the inverse slide styles, namely the color is chosen to work well with the inverse slide styles, namely the
value of \code{inverse_header_color}} value of \code{inverse_header_color}}


\item{na.value}{Color to be used for missing data points.}

\item{begin}{Number in the range of \code{[0, 1]} indicating to which point in the color scale the smallest data value should be mapped.} \item{begin}{Number in the range of \code{[0, 1]} indicating to which point in the color scale the smallest data value should be mapped.}


\item{end}{Number in the range of \code{[0, 1]} indicating to which point in the color scale the largest data value should be mapped.} \item{end}{Number in the range of \code{[0, 1]} indicating to which point in the color scale the largest data value should be mapped.}

Загрузка…
Отмена
Сохранить