Skip to content

Commit

Permalink
Better parity with continuous limits
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Jan 14, 2025
1 parent ad8e6c7 commit 9528e52
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions R/scale-discrete-.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#' @param continuous.limits One of:
#' * `NULL` to use the default scale range
#' * A numeric vector of length two providing a display range for the scale.
#' * A function that accepts the existing continuous limits and returns a
#' numeric vector of length two.
#' Use `NA` to refer to the existing minimum or maximum.
#' * A function that accepts the limits and returns a numeric vector of
#' length two.
#' @rdname scale_discrete
#' @family position scales
#' @seealso
Expand Down
3 changes: 1 addition & 2 deletions R/scale-expansion.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ expand_limits_discrete <- function(limits, expand = expansion(0, 0), coord_limit
check_numeric(continuous_limits, arg = "continuous.limits")
check_length(continuous_limits, 2L, arg = "continuous.limits")
missing <- is.na(continuous_limits)
limits <- range(ifelse(missing, limits, continuous_limits))
coord_limits <- range(ifelse(missing, coord_limits, continuous_limits))
limits <- ifelse(missing, range(limits), continuous_limits)
}

limit_info <- expand_limits_discrete_trans(
Expand Down
5 changes: 3 additions & 2 deletions man/scale_discrete.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9528e52

Please sign in to comment.