Skip to content

Commit

Permalink
Add na transparent
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Nov 20, 2023
1 parent 8210e4a commit de900a8
Show file tree
Hide file tree
Showing 20 changed files with 129 additions and 87 deletions.
14 changes: 12 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
# tidyterra (development version)

**tidyterra** has been accepted on JOSS. Please use the result of
`citation("tidyterra")` or the following string:

> Hernangómez, D. (2023). "Using the tidyverse with terra objects: the tidyterra
> package." *Journal of Open Source Software*, *8*(91), 5751. ISSN 2475-9066,
> <https://doi.org/10.21105/joss.05751>
Other changes on this version:

- Support for SpatRasters with a color table
- `autoplot.SpatRaster()` can detect now SpatRasters with color tables.
- `geom_spatraster()` can detect now SpatRasters with color tables.
- New scales for plotting SpatRasters with color tables:
`scale_fill_coltab()` and rest of family scales (`colour`).
- tidyverse verbs keeps the associated `coltab` of a SpatRaster.
- By default all the discrete scales of tidyterra now have the following
- By default all the discrete scales of **tidyterra** now have the following
setup: `na.translate = FALSE`.
- By default, all the non-discrete (e.g. continuous or breaks) scales of
**tidyterra** have now `na.value = "transparent"` (#120).
- Enhanced `glimpse.Spat()` with meta-information on type of geometry, crs,
etc.
- New messaging interface thanks to [**cli**](https://cli.r-lib.org/) package.
- Update citation.

# tidyterra 0.4.1

Expand Down
4 changes: 2 additions & 2 deletions R/scales_coltab.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#' }
scale_fill_coltab <- function(data, ..., alpha = 1,
na.translate = FALSE,
na.value = NA,
na.value = "transparent",

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
drop = TRUE) {
getcols <- get_coltab_pal(data)
if (is.null(getcols)) {
Expand All @@ -88,7 +88,7 @@ scale_fill_coltab <- function(data, ..., alpha = 1,
#' @rdname scale_coltab
#' @export
scale_colour_coltab <- function(data, ..., alpha = 1, na.translate = FALSE,
na.value = NA, drop = TRUE) {
na.value = "transparent", drop = TRUE) {

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
getcols <- get_coltab_pal(data)
if (is.null(getcols)) {
return(ggplot2::geom_blank())
Expand Down
22 changes: 13 additions & 9 deletions R/scales_cross_blended.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@
#' @name scale_cross_blended
#'
#' @inheritDotParams ggplot2::discrete_scale breaks:drop
#' @inheritDotParams ggplot2::continuous_scale breaks:labels na.value
#' @inheritDotParams ggplot2::continuous_scale breaks:labels
#' @inheritDotParams ggplot2::binned_scale breaks:limits nice.breaks
#' @param na.translate Should `NA` values be removed from the legend? Default
#' is `TRUE`.
#' @param na.value Missing values will be replaced with this value. By default,
#' \CRANpkg{tidyterra} uses `na.value = "transparent"` so cells with `NA` are
#' not filled. See also
#' [#120](https://github.com/dieghernan/tidyterra/issues/120).
#' @param drop Should unused factor levels be omitted from the scale? The
#' default (`TRUE`) removes unused factors.
#' @inheritParams ggplot2::scale_fill_viridis_b
Expand Down Expand Up @@ -233,7 +237,7 @@ scale_colour_cross_blended_d <- function(palette = "cold_humid", ...,
#' @rdname scale_cross_blended
scale_fill_cross_blended_c <- function(palette = "cold_humid", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice on line 240 in R/scales_cross_blended.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_cross_blended.R#L240

Lines should not be more than 80 characters. This line is 87 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 87 characters. Note

Lines should not be more than 80 characters. This line is 87 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -264,7 +268,7 @@ scale_fill_cross_blended_c <- function(palette = "cold_humid", ...,
#' @rdname scale_cross_blended
scale_colour_cross_blended_c <- function(palette = "cold_humid", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice on line 271 in R/scales_cross_blended.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_cross_blended.R#L271

Lines should not be more than 80 characters. This line is 89 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 89 characters. Note

Lines should not be more than 80 characters. This line is 89 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -294,7 +298,7 @@ scale_colour_cross_blended_c <- function(palette = "cold_humid", ...,
#' @rdname scale_cross_blended
scale_fill_cross_blended_b <- function(palette = "cold_humid", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 301 in R/scales_cross_blended.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_cross_blended.R#L301

Lines should not be more than 80 characters. This line is 89 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 89 characters. Note

Lines should not be more than 80 characters. This line is 89 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -323,7 +327,7 @@ scale_fill_cross_blended_b <- function(palette = "cold_humid", ...,
#' @rdname scale_cross_blended
scale_colour_cross_blended_b <- function(palette = "cold_humid", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 330 in R/scales_cross_blended.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_cross_blended.R#L330

Lines should not be more than 80 characters. This line is 91 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 91 characters. Note

Lines should not be more than 80 characters. This line is 91 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -476,7 +480,7 @@ scale_fill_cross_blended_tint_c <- function(palette = "cold_humid", ...,
alpha = 1, direction = 1,
values = NULL,
limits = NULL,
na.value = NA,
na.value = "transparent",

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
guide = "colourbar") {
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
Expand Down Expand Up @@ -521,7 +525,7 @@ scale_colour_cross_blended_tint_c <- function(palette = "cold_humid", ...,
alpha = 1, direction = 1,
values = NULL,
limits = NULL,
na.value = NA,
na.value = "transparent",

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
guide = "colourbar") {
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
Expand Down Expand Up @@ -566,7 +570,7 @@ scale_fill_cross_blended_tint_b <- function(palette = "cold_humid", ...,
alpha = 1, direction = 1,
values = NULL,
limits = NULL,
na.value = NA,
na.value = "transparent",

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
guide = "coloursteps") {
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
Expand Down Expand Up @@ -612,7 +616,7 @@ scale_colour_cross_blended_tint_b <- function(palette = "cold_humid", ...,
alpha = 1, direction = 1,
values = NULL,
limits = NULL,
na.value = NA,
na.value = "transparent",

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
guide = "coloursteps") {
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
Expand Down
18 changes: 9 additions & 9 deletions R/scales_hypso.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#' @name scale_hypso
#'
#' @inheritDotParams ggplot2::discrete_scale breaks:drop
#' @inheritDotParams ggplot2::continuous_scale breaks:labels na.value
#' @inheritDotParams ggplot2::continuous_scale breaks:labels
#' @inheritDotParams ggplot2::binned_scale breaks:limits nice.breaks
#' @inheritParams scale_cross_blended
#' @param palette A valid palette name. The name is matched to the list of
Expand Down Expand Up @@ -224,7 +224,7 @@ scale_colour_hypso_d <- function(palette = "etopo1_hypso", ...,
#' @rdname scale_hypso
scale_fill_hypso_c <- function(palette = "etopo1_hypso", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -254,7 +254,7 @@ scale_fill_hypso_c <- function(palette = "etopo1_hypso", ...,
#' @rdname scale_hypso
scale_colour_hypso_c <- function(palette = "etopo1_hypso", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice on line 257 in R/scales_hypso.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_hypso.R#L257

Lines should not be more than 80 characters. This line is 81 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 81 characters. Note

Lines should not be more than 80 characters. This line is 81 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -284,7 +284,7 @@ scale_colour_hypso_c <- function(palette = "etopo1_hypso", ...,
#' @rdname scale_hypso
scale_fill_hypso_b <- function(palette = "etopo1_hypso", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 287 in R/scales_hypso.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_hypso.R#L287

Lines should not be more than 80 characters. This line is 81 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 81 characters. Note

Lines should not be more than 80 characters. This line is 81 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -313,7 +313,7 @@ scale_fill_hypso_b <- function(palette = "etopo1_hypso", ...,
#' @rdname scale_hypso
scale_colour_hypso_b <- function(palette = "etopo1_hypso", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 316 in R/scales_hypso.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_hypso.R#L316

Lines should not be more than 80 characters. This line is 83 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 83 characters. Note

Lines should not be more than 80 characters. This line is 83 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -463,7 +463,7 @@ scale_fill_hypso_tint_c <- function(palette = "etopo1_hypso", ...,
alpha = 1, direction = 1,
values = NULL,
limits = NULL,
na.value = NA,
na.value = "transparent",

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
guide = "colourbar") {
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
Expand Down Expand Up @@ -507,7 +507,7 @@ scale_colour_hypso_tint_c <- function(palette = "etopo1_hypso", ...,
alpha = 1, direction = 1,
values = NULL,
limits = NULL,
na.value = NA,
na.value = "transparent",

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
guide = "colourbar") {
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
Expand Down Expand Up @@ -552,7 +552,7 @@ scale_fill_hypso_tint_b <- function(palette = "etopo1_hypso", ...,
alpha = 1, direction = 1,
values = NULL,
limits = NULL,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 555 in R/scales_hypso.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_hypso.R#L555

Lines should not be more than 80 characters. This line is 86 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 86 characters. Note

Lines should not be more than 80 characters. This line is 86 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -596,7 +596,7 @@ scale_colour_hypso_tint_b <- function(palette = "etopo1_hypso", ...,
alpha = 1, direction = 1,
values = NULL,
limits = NULL,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 599 in R/scales_hypso.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_hypso.R#L599

Lines should not be more than 80 characters. This line is 88 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 88 characters. Note

Lines should not be more than 80 characters. This line is 88 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down
10 changes: 5 additions & 5 deletions R/scales_terrain.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' @name scale_terrain
#'
#' @inheritDotParams ggplot2::discrete_scale breaks:drop
#' @inheritDotParams ggplot2::continuous_scale breaks:labels na.value
#' @inheritDotParams ggplot2::continuous_scale breaks:labels
#' @inheritDotParams ggplot2::binned_scale breaks:limits nice.breaks
#' @inheritParams scale_cross_blended
#'
Expand Down Expand Up @@ -127,7 +127,7 @@ scale_colour_terrain_d <- function(..., alpha = 1, direction = 1,
#' @export
#' @rdname scale_terrain
scale_fill_terrain_c <- function(..., alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice on line 130 in R/scales_terrain.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_terrain.R#L130

Lines should not be more than 80 characters. This line is 81 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 81 characters. Note

Lines should not be more than 80 characters. This line is 81 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand All @@ -152,7 +152,7 @@ scale_fill_terrain_c <- function(..., alpha = 1, direction = 1,
#' @export
#' @rdname scale_terrain
scale_colour_terrain_c <- function(..., alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice on line 155 in R/scales_terrain.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_terrain.R#L155

Lines should not be more than 80 characters. This line is 83 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 83 characters. Note

Lines should not be more than 80 characters. This line is 83 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand All @@ -178,7 +178,7 @@ scale_colour_terrain_c <- function(..., alpha = 1, direction = 1,
#' @export
#' @rdname scale_terrain
scale_fill_terrain_b <- function(..., alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 181 in R/scales_terrain.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_terrain.R#L181

Lines should not be more than 80 characters. This line is 83 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 83 characters. Note

Lines should not be more than 80 characters. This line is 83 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand All @@ -203,7 +203,7 @@ scale_fill_terrain_b <- function(..., alpha = 1, direction = 1,
#' @export
#' @rdname scale_terrain
scale_colour_terrain_b <- function(..., alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 206 in R/scales_terrain.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_terrain.R#L206

Lines should not be more than 80 characters. This line is 85 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 85 characters. Note

Lines should not be more than 80 characters. This line is 85 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down
10 changes: 5 additions & 5 deletions R/scales_whitebox.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' @name scale_whitebox
#'
#' @inheritDotParams ggplot2::discrete_scale breaks:drop
#' @inheritDotParams ggplot2::continuous_scale breaks:labels na.value
#' @inheritDotParams ggplot2::continuous_scale breaks:labels
#' @inheritDotParams ggplot2::binned_scale breaks:limits nice.breaks
#' @inheritParams scale_cross_blended
#' @param palette A valid palette name. The name is matched to the list of
Expand Down Expand Up @@ -153,7 +153,7 @@ scale_colour_whitebox_d <- function(palette = "high_relief", ...,
#' @rdname scale_whitebox
scale_fill_whitebox_c <- function(palette = "high_relief", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice on line 156 in R/scales_whitebox.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_whitebox.R#L156

Lines should not be more than 80 characters. This line is 82 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 82 characters. Note

Lines should not be more than 80 characters. This line is 82 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -182,7 +182,7 @@ scale_fill_whitebox_c <- function(palette = "high_relief", ...,
#' @rdname scale_whitebox
scale_colour_whitebox_c <- function(palette = "high_relief", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice on line 185 in R/scales_whitebox.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_whitebox.R#L185

Lines should not be more than 80 characters. This line is 84 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 84 characters. Note

Lines should not be more than 80 characters. This line is 84 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -212,7 +212,7 @@ scale_colour_whitebox_c <- function(palette = "high_relief", ...,
#' @rdname scale_whitebox
scale_fill_whitebox_b <- function(palette = "high_relief", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 215 in R/scales_whitebox.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_whitebox.R#L215

Lines should not be more than 80 characters. This line is 84 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 84 characters. Note

Lines should not be more than 80 characters. This line is 84 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -242,7 +242,7 @@ scale_fill_whitebox_b <- function(palette = "high_relief", ...,
#' @rdname scale_whitebox
scale_colour_whitebox_b <- function(palette = "high_relief", ...,
alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 245 in R/scales_whitebox.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_whitebox.R#L245

Lines should not be more than 80 characters. This line is 86 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 86 characters. Note

Lines should not be more than 80 characters. This line is 86 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down
12 changes: 6 additions & 6 deletions R/scales_wiki.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
#'
#' @name scale_wiki
#'
#' @inheritParams scale_cross_blended
#' @inheritDotParams ggplot2::discrete_scale breaks:drop
#' @inheritDotParams ggplot2::continuous_scale breaks:labels na.value
#' @inheritDotParams ggplot2::continuous_scale breaks:labels
#' @inheritDotParams ggplot2::binned_scale breaks:limits nice.breaks
#' @inheritParams ggplot2::scale_fill_viridis_b
#' @inheritParams ggplot2::continuous_scale
#' @inheritParams scale_cross_blended
#' @seealso [terra::plot()], [ggplot2::scale_fill_viridis_c()]
#'
#' See also \pkg{ggplot2} docs on additional `...` parameters:
Expand Down Expand Up @@ -140,7 +140,7 @@ scale_color_wiki_d <- scale_colour_wiki_d
#' @export
#' @rdname scale_wiki
scale_fill_wiki_c <- function(..., alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand All @@ -167,7 +167,7 @@ scale_fill_wiki_c <- function(..., alpha = 1, direction = 1,
#' @export
#' @rdname scale_wiki
scale_colour_wiki_c <- function(..., alpha = 1, direction = 1,
na.value = NA, guide = "colourbar") {
na.value = "transparent", guide = "colourbar") {

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down Expand Up @@ -199,7 +199,7 @@ scale_color_wiki_c <- scale_colour_wiki_c
#' @export
#' @rdname scale_wiki
scale_fill_wiki_b <- function(..., alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand All @@ -226,7 +226,7 @@ scale_fill_wiki_b <- function(..., alpha = 1, direction = 1,
#' @export
#' @rdname scale_wiki
scale_colour_wiki_b <- function(..., alpha = 1, direction = 1,
na.value = NA, guide = "coloursteps") {
na.value = "transparent", guide = "coloursteps") {

Check notice on line 229 in R/scales_wiki.R

View check run for this annotation

codefactor.io / CodeFactor

R/scales_wiki.R#L229

Lines should not be more than 80 characters. This line is 82 characters. (line_length_linter)

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols. Note

Variable and function name style should match snake_case or symbols.

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 82 characters. Note

Lines should not be more than 80 characters. This line is 82 characters.
if (alpha < 0 || alpha > 1) {
cli::cli_abort("{.arg alpha} {.field {alpha}} not in {.field [0,1]}")
}
Expand Down
4 changes: 2 additions & 2 deletions R/stat_spatraster.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#' aes(color = after_stat(value)),
#' geom = "point", maxcell = 250
#' ) +
#' scale_colour_viridis_c(na.value = NA) +
#' scale_colour_viridis_c(na.value = "transparent") +
#' facet_wrap(~lyr)
#'
#' # Using points and labels
Expand All @@ -68,7 +68,7 @@
#' alpha = 0.85,
#' maxcell = 20
#' ) +
#' scale_colour_viridis_c(na.value = NA)
#' scale_colour_viridis_c(na.value = "transparent")
#' }
stat_spatraster <- function(mapping = aes(),
data,
Expand Down
Loading

0 comments on commit de900a8

Please sign in to comment.