|
|
@ -45,13 +45,26 @@ is.formula <- function (x) { inherits(x, "formula") } |
|
|
|
#' scales, "top" or "bottom" for horizontal scales |
|
|
|
#' @param sec.axis specify a secondary axis |
|
|
|
#' @export |
|
|
|
scale_x_percent <- function(name = waiver(), breaks = waiver(), |
|
|
|
scale_x_percent <- function(name = waiver(), |
|
|
|
breaks = waiver(), |
|
|
|
minor_breaks = waiver(), |
|
|
|
limits = NULL, expand = c(0.01,0), oob = censor, |
|
|
|
na.value = NA_real_, trans = "identity", |
|
|
|
position = "bottom", sec.axis = waiver(), labels, |
|
|
|
accuracy = 1, scale = 100, prefix = "", suffix = "%", |
|
|
|
big.mark = " ", decimal.mark = ".", trim = TRUE, ...) { |
|
|
|
guide = waiver(), |
|
|
|
n.breaks = NULL, |
|
|
|
labels, |
|
|
|
limits = NULL, |
|
|
|
expand = c(0.01,0), |
|
|
|
oob = censor, |
|
|
|
na.value = NA_real_, |
|
|
|
trans = "identity", |
|
|
|
position = "bottom", |
|
|
|
sec.axis = waiver(), |
|
|
|
accuracy = 1, |
|
|
|
scale = 100, |
|
|
|
prefix = "", |
|
|
|
suffix = "%", |
|
|
|
big.mark = " ", |
|
|
|
decimal.mark = ".", |
|
|
|
trim = TRUE, ...) { |
|
|
|
|
|
|
|
if (missing(labels)) { |
|
|
|
scales::percent_format( |
|
|
@ -69,12 +82,13 @@ scale_x_percent <- function(name = waiver(), breaks = waiver(), |
|
|
|
ggplot2::continuous_scale( |
|
|
|
aesthetics = c( |
|
|
|
"x", "xmin", "xmax", "xend", "xintercept", "xmin_final", |
|
|
|
"xmax_final", "xlower", "xmiddle", "xupper" |
|
|
|
"xmax_final", "xlower", "xmiddle", "xupper", "x0" |
|
|
|
), |
|
|
|
scale_name = "position_c", |
|
|
|
palette = identity, |
|
|
|
name = name, |
|
|
|
breaks = breaks, |
|
|
|
n.breaks = n.breaks, |
|
|
|
minor_breaks = minor_breaks, |
|
|
|
labels = labels, |
|
|
|
limits = limits, |
|
|
@ -82,7 +96,7 @@ scale_x_percent <- function(name = waiver(), breaks = waiver(), |
|
|
|
oob = oob, |
|
|
|
na.value = na.value, |
|
|
|
trans = trans, |
|
|
|
guide = "none", |
|
|
|
guide = guide, |
|
|
|
position = position, |
|
|
|
super = ScaleContinuousPosition |
|
|
|
) -> sc |
|
|
@ -102,13 +116,26 @@ scale_x_percent <- function(name = waiver(), breaks = waiver(), |
|
|
|
|
|
|
|
#' @rdname scale_x_percent |
|
|
|
#' @export |
|
|
|
scale_y_percent <- function(name = waiver(), breaks = waiver(), |
|
|
|
scale_y_percent <- function(name = waiver(), |
|
|
|
breaks = waiver(), |
|
|
|
minor_breaks = waiver(), |
|
|
|
limits = NULL, expand = c(0.01,0), oob = censor, |
|
|
|
na.value = NA_real_, trans = "identity", |
|
|
|
position = "left", sec.axis = waiver(), labels, |
|
|
|
accuracy = 1, scale = 100, prefix = "", suffix = "%", |
|
|
|
big.mark = " ", decimal.mark = ".", trim = TRUE, ...) { |
|
|
|
guide = waiver(), |
|
|
|
n.breaks = NULL, |
|
|
|
labels, |
|
|
|
limits = NULL, |
|
|
|
expand = c(0.01,0), |
|
|
|
oob = censor, |
|
|
|
na.value = NA_real_, |
|
|
|
trans = "identity", |
|
|
|
position = "left", |
|
|
|
sec.axis = waiver(), |
|
|
|
accuracy = 1, |
|
|
|
scale = 100, |
|
|
|
prefix = "", |
|
|
|
suffix = "%", |
|
|
|
big.mark = " ", |
|
|
|
decimal.mark = ".", |
|
|
|
trim = TRUE, ...) { |
|
|
|
|
|
|
|
if (missing(labels)) { |
|
|
|
scales::percent_format( |
|
|
@ -132,6 +159,7 @@ scale_y_percent <- function(name = waiver(), breaks = waiver(), |
|
|
|
palette = identity, |
|
|
|
name = name, |
|
|
|
breaks = breaks, |
|
|
|
n.breaks = n.breaks, |
|
|
|
minor_breaks = minor_breaks, |
|
|
|
labels = labels, |
|
|
|
limits = limits, |
|
|
@ -139,7 +167,7 @@ scale_y_percent <- function(name = waiver(), breaks = waiver(), |
|
|
|
oob = oob, |
|
|
|
na.value = na.value, |
|
|
|
trans = trans, |
|
|
|
guide = "none", |
|
|
|
guide = guide, |
|
|
|
position = position, |
|
|
|
super = ScaleContinuousPosition |
|
|
|
) -> sc |
|
|
@ -162,14 +190,26 @@ scale_y_percent <- function(name = waiver(), breaks = waiver(), |
|
|
|
#' [scales::comma_format()] or [scales::percent_format()] |
|
|
|
#' @param ... passed on to [scales::comma_format()] or [scales::percent_format()] |
|
|
|
#' @export |
|
|
|
scale_x_comma <- function(name = waiver(), breaks = waiver(), |
|
|
|
scale_x_comma <- function(name = waiver(), |
|
|
|
breaks = waiver(), |
|
|
|
minor_breaks = waiver(), |
|
|
|
guide = waiver(), |
|
|
|
n.breaks = NULL, |
|
|
|
labels, |
|
|
|
limits = NULL, |
|
|
|
expand = c(0.01,0), oob = censor, |
|
|
|
na.value = NA_real_, trans = "identity", |
|
|
|
position = "bottom", sec.axis = waiver(), labels, |
|
|
|
accuracy = 1, scale = 1, prefix = "", suffix = "", |
|
|
|
big.mark = ",", decimal.mark = ".", trim = TRUE, |
|
|
|
expand = c(0.01,0), |
|
|
|
oob = censor, |
|
|
|
na.value = NA_real_, |
|
|
|
trans = "identity", |
|
|
|
position = "bottom", |
|
|
|
sec.axis = waiver(), |
|
|
|
accuracy = 1, |
|
|
|
scale = 1, |
|
|
|
prefix = "", |
|
|
|
suffix = "", |
|
|
|
big.mark = ",", |
|
|
|
decimal.mark = ".", |
|
|
|
trim = TRUE, |
|
|
|
...) { |
|
|
|
|
|
|
|
if (missing(labels)) { |
|
|
@ -195,6 +235,7 @@ scale_x_comma <- function(name = waiver(), breaks = waiver(), |
|
|
|
palette = identity, |
|
|
|
name = name, |
|
|
|
breaks = breaks, |
|
|
|
n.breaks = n.breaks, |
|
|
|
minor_breaks = minor_breaks, |
|
|
|
labels = labels, |
|
|
|
limits = limits, |
|
|
@ -202,7 +243,7 @@ scale_x_comma <- function(name = waiver(), breaks = waiver(), |
|
|
|
oob = oob, |
|
|
|
na.value = na.value, |
|
|
|
trans = trans, |
|
|
|
guide = "none", |
|
|
|
guide = guide, |
|
|
|
position = position, |
|
|
|
super = ScaleContinuousPosition |
|
|
|
) -> sc |
|
|
@ -225,11 +266,23 @@ scale_x_comma <- function(name = waiver(), breaks = waiver(), |
|
|
|
scale_y_comma <- function(name = waiver(), |
|
|
|
breaks = waiver(), |
|
|
|
minor_breaks = waiver(), |
|
|
|
limits = NULL, expand = c(0.01,0), oob = censor, |
|
|
|
na.value = NA_real_, trans = "identity", |
|
|
|
position = "left", sec.axis = waiver(), labels, |
|
|
|
accuracy = 1, scale = 1, prefix = "", suffix = "", |
|
|
|
big.mark = ",", decimal.mark = ".", trim = TRUE, |
|
|
|
guide = waiver(), |
|
|
|
n.breaks = NULL, |
|
|
|
labels, |
|
|
|
limits = NULL, |
|
|
|
expand = c(0.01,0), |
|
|
|
oob = censor, |
|
|
|
na.value = NA_real_, |
|
|
|
trans = "identity", |
|
|
|
position = "left", |
|
|
|
sec.axis = waiver(), |
|
|
|
accuracy = 1, |
|
|
|
scale = 1, |
|
|
|
prefix = "", |
|
|
|
suffix = "", |
|
|
|
big.mark = ",", |
|
|
|
decimal.mark = ".", |
|
|
|
trim = TRUE, |
|
|
|
...) { |
|
|
|
|
|
|
|
if (missing(labels)) { |
|
|
@ -255,6 +308,7 @@ scale_y_comma <- function(name = waiver(), |
|
|
|
palette = identity, |
|
|
|
name = name, |
|
|
|
breaks = breaks, |
|
|
|
n.breaks = n.breaks, |
|
|
|
minor_breaks = minor_breaks, |
|
|
|
labels = labels, |
|
|
|
limits = limits, |
|
|
@ -262,7 +316,7 @@ scale_y_comma <- function(name = waiver(), |
|
|
|
oob = oob, |
|
|
|
na.value = na.value, |
|
|
|
trans = trans, |
|
|
|
guide = "none", |
|
|
|
guide = guide, |
|
|
|
position = position, |
|
|
|
super = ScaleContinuousPosition |
|
|
|
) -> sc |
|
|
|