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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
#' Edge fill scales
#'
#' This set of scales defines new fill scales for edge geoms equivalent to the
#' ones already defined by ggplot2. The parameters are equivalent to the ones
#' from ggplot2 so there is nothing new under the sun. The different geoms will
#' know whether to use edge scales or the standard scales so it is not necessary
#' to write `edge_fill` in the call to the geom - just use `fill`.
#'
#' @return A ggproto object inheriting from `Scale`
#'
#' @family scale_edge_*
#'
#' @name scale_edge_fill
#' @rdname scale_edge_fill
#'
NULL
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_hue
#'
#' @export
scale_edge_fill_hue <- function(..., h = c(0, 360) + 15, c = 100, l = 65, h.start = 0,
direction = 1, na.value = "grey50", aesthetics = "edge_fill") {
scale_fill_hue(..., h = h, c = c, l = l, h.start = h.start,
direction = direction, na.value = na.value, aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_brewer
#'
#' @export
scale_edge_fill_brewer <- function(..., type = "seq", palette = 1, direction = 1,
aesthetics = "edge_fill") {
scale_fill_brewer(..., type = type, palette = palette, direction = direction,
aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_distiller
#'
#' @export
scale_edge_fill_distiller <- function(..., type = "seq", palette = 1, direction = -1,
values = NULL, space = "Lab", na.value = "grey50",
guide = "edge_colourbar", aesthetics = "edge_fill") {
scale_color_distiller(..., type = type, palette = palette, direction = direction,
values = values, space = space, na.value = na.value,
guide = guide, aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_gradient
#'
#' @export
scale_edge_fill_gradient <- function(..., low = "#132B43", high = "#56B1F7", space = "Lab",
na.value = "grey50", guide = "edge_colourbar",
aesthetics = "edge_fill") {
scale_fill_gradient(..., low = low, high = high, space = space, na.value = na.value,
guide = guide, aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_gradient2
#'
#' @importFrom scales muted
#' @export
scale_edge_fill_gradient2 <- function(..., low = muted("red"), mid = "white",
high = muted("blue"), midpoint = 0,
space = "Lab", na.value = "grey50",
guide = "edge_colourbar", aesthetics = "edge_fill") {
scale_fill_gradient2(..., low = low, mid = mid, high = high, midpoint = midpoint,
space = space, na.value = na.value, guide = guide,
aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_gradientn
#'
#' @export
scale_edge_fill_gradientn <- function(..., colours, values = NULL, space = "Lab",
na.value = "grey50", guide = "edge_colourbar",
aesthetics = "edge_fill", colors) {
scale_fill_gradientn(..., colours = colours, values = values, space = space,
na.value = na.value, guide = guide, aesthetics = aesthetics,
colors = colors)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_grey
#'
#' @export
scale_edge_fill_grey <- function(..., start = 0.2, end = 0.8, na.value = "red",
aesthetics = "edge_fill") {
scale_fill_grey(..., start = start, end = end, na.value = na.value, aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_identity
#'
#' @export
scale_edge_fill_identity <- function(..., guide = "none", aesthetics = "edge_fill") {
scale_fill_identity(..., guide = guide, aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_manual
#'
#' @export
scale_edge_fill_manual <- function(..., values, aesthetics = "edge_fill", breaks = waiver(), na.value = "grey50") {
scale_fill_manual(..., values = values, aesthetics = aesthetics, breaks = breaks,
na.value = na.value)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams viridis::scale_fill_viridis
#'
#' @importFrom viridis scale_fill_viridis
#' @export
scale_edge_fill_viridis <- function (..., alpha = 1, begin = 0, end = 1, direction = 1,
discrete = FALSE, option = "D", aesthetics = 'edge_fill') {
scale_fill_viridis(..., alpha = alpha, begin = begin, end = end, direction = direction,
discrete = discrete, option = option, aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_steps
#' @export
scale_edge_fill_steps <- function(..., low = "#132B43", high = "#56B1F7", space = "Lab",
na.value = "grey50", guide = "edge_coloursteps",
aesthetics = "edge_fill") {
scale_fill_steps(..., low = low, high = high, space = space, na.value = na.value,
guide = guide, aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_steps2
#' @export
scale_edge_fill_steps2 <- function(..., low = muted("red"), mid = "white", high = muted("blue"),
midpoint = 0, space = "Lab", na.value = "grey50",
guide = "edge_coloursteps",
aesthetics = "edge_fill") {
scale_fill_steps2(..., low = low, mid = mid, high = high, midpoint = midpoint, space = space,
na.value = na.value, guide = guide, aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_stepsn
#' @export
scale_edge_fill_stepsn <- function(..., colours, values = NULL, space = "Lab", na.value = "grey50",
guide = "edge_coloursteps", aesthetics = "edge_fill", colors) {
scale_fill_stepsn(..., colours = colours, values = values, space = space,
na.value = na.value, guide = guide, aesthetics = aesthetics,
colors = colors)
}
#' @rdname scale_edge_fill
#'
#' @inheritParams ggplot2::scale_fill_fermenter
#' @export
scale_edge_fill_fermenter <- function(..., type = "seq", palette = 1, direction = -1,
na.value = "grey50", guide = "edge_coloursteps",
aesthetics = "edge_fill") {
scale_fill_fermenter(..., type = type, palette = palette, direction = direction,
na.value = na.value, guide = guide, aesthetics = aesthetics)
}
#' @rdname scale_edge_fill
#'
#' @export
scale_edge_fill_continuous <- scale_edge_fill_gradient
#' @rdname scale_edge_fill
#'
#' @export
scale_edge_fill_discrete <- scale_edge_fill_hue
#' @rdname scale_edge_fill
#'
#' @export
scale_edge_fill_binned <- scale_edge_fill_steps
|