1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#' Edge alpha scales
#'
#' This set of scales defines new alpha scales for edge geoms equivalent to the
#' ones already defined by ggplot2. See [ggplot2::scale_alpha()] for
#' more information. The different geoms will know whether to use edge scales or
#' the standard scales so it is not necessary to write `edge_alpha` in
#' the call to the geom - just use `alpha`.
#'
#' @return A ggproto object inheriting from `Scale`
#'
#' @family scale_edge_*
#'
#' @name scale_edge_alpha
#' @rdname scale_edge_alpha
#'
NULL
#' @rdname scale_edge_alpha
#'
#' @inheritParams ggplot2::scale_alpha
#'
#' @importFrom scales rescale_pal
#' @export
scale_edge_alpha <- function(..., range = c(0.1, 1)) {
sc <- scale_alpha(..., range = range)
sc$aesthetics <- 'edge_alpha'
sc
}
#' @rdname scale_edge_alpha
#'
#' @export
scale_edge_alpha_continuous <- scale_edge_alpha
#' @rdname scale_edge_alpha
#'
#'
#' @inheritParams ggplot2::scale_alpha_discrete
#'
#' @export
scale_edge_alpha_discrete <- function(..., range = c(0.1, 1)) {
sc <- scale_alpha_discrete(..., range = range)
sc$aesthetics <- 'edge_alpha'
sc
}
#' @rdname scale_edge_alpha
#'
#'
#' @inheritParams ggplot2::scale_alpha_binned
#'
#' @export
scale_edge_alpha_binned <- function(..., range = c(0.1, 1)) {
sc <- scale_alpha_binned(..., range = range)
sc$aesthetics <- 'edge_alpha'
sc
}
#' @rdname scale_edge_alpha
#'
#' @inheritParams ggplot2::scale_alpha_manual
#'
#' @export
scale_edge_alpha_manual <- function(..., values, breaks = waiver(), na.value = NA) {
sc <- scale_alpha_manual(..., values = values, breaks = breaks, na.value = na.value)
sc$aesthetics <- 'edge_alpha'
sc
}
#' @rdname scale_edge_alpha
#'
#' @inheritParams ggplot2::scale_alpha_identity
#'
#' @importFrom scales identity_pal
#' @export
scale_edge_alpha_identity <- function(..., guide = 'none') {
sc <- scale_alpha_identity(..., guide = guide)
sc$aesthetics <- 'edge_alpha'
sc
}
|