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

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 месеци
родитељ
комит
5071cb3d14
No account linked to committer's email address
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 Прегледај датотеку

@@ -1,5 +1,9 @@
# 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

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

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

@@ -596,7 +596,8 @@ scale_xaringan_discrete <- function(
...,
color = NULL,
direction = 1,
inverse = FALSE
inverse = FALSE,
na.value = "grey50"
) {
requires_package("ggplot2", "scale_xaringan_discrete")

@@ -613,7 +614,7 @@ scale_xaringan_discrete <- function(
)
}

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

#' @rdname scale_xaringan
@@ -662,7 +663,8 @@ scale_xaringan_continuous <- function(
color = NULL,
begin = 0,
end = 1,
inverse = FALSE
inverse = FALSE,
na.value = "grey50"
) {
requires_package("ggplot2", "scale_xaringan_continuous")
requires_package("scales", "scale_xaringan_continuous")
@@ -687,6 +689,7 @@ scale_xaringan_continuous <- function(
palette = scales::gradient_n_pal(colors, values = NULL),
rescaler = rescaler,
oob = scales::censor,
na.value = na.value,
...
)
}

+ 6
- 2
man/scale_xaringan.Rd Прегледај датотеку

@@ -17,7 +17,8 @@ scale_xaringan_discrete(
...,
color = NULL,
direction = 1,
inverse = FALSE
inverse = FALSE,
na.value = "grey50"
)

scale_xaringan_fill_discrete(..., color = NULL, direction = 1, inverse = FALSE)
@@ -42,7 +43,8 @@ scale_xaringan_continuous(
color = NULL,
begin = 0,
end = 1,
inverse = FALSE
inverse = FALSE,
na.value = "grey50"
)

scale_xaringan_fill_continuous(
@@ -91,6 +93,8 @@ reverse the direction, e.g. \code{direction = -1}.}
color is chosen to work well with the inverse slide styles, namely the
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{end}{Number in the range of \code{[0, 1]} indicating to which point in the color scale the largest data value should be mapped.}

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