diff --git a/DESCRIPTION b/DESCRIPTION index fc6eab4..7c7c691 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -85,6 +85,7 @@ Collate: 'position-dodge-nudge-to.R' 'position-dodge-nudge.R' 'position-dodge2-nudge.R' + 'position-dodge2nudge-to.R' 'position-jitter-nudge.R' 'position-nudge-center.R' 'position-nudge-line.R' diff --git a/NAMESPACE b/NAMESPACE index 4e4abf1..64ae45e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -25,6 +25,7 @@ export(GeomXMarginPoint) export(GeomYMarginArrow) export(GeomYMarginGrob) export(GeomYMarginPoint) +export(PositionDodge2AndNudgeTo) export(PositionDodgeNudgeTo) export(PositionFillAndNudge) export(PositionNudgeCenter) @@ -74,6 +75,7 @@ export(geom_y_margin_grob) export(geom_y_margin_point) export(position_dodge2_keep) export(position_dodge2nudge) +export(position_dodge2nudge_to) export(position_dodge_keep) export(position_dodgenudge) export(position_dodgenudge_to) diff --git a/NEWS.md b/NEWS.md index 191305d..6eb5820 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,8 +8,8 @@ editor_options: # ggpp 0.5.9 -- Add `position_dodgenudge_to()` that allows the action of `position_nudge_to()` -to preceded by dodging. +- Add `position_dodgenudge_to()` and `position_dodge2nudge_to()` that allow the +action of `position_nudge_to()` to be combined with dodging. # ggpp 0.5.8-1 diff --git a/R/position-dodge-nudge-to.R b/R/position-dodge-nudge-to.R index 64f7264..9b663c8 100644 --- a/R/position-dodge-nudge-to.R +++ b/R/position-dodge-nudge-to.R @@ -1,4 +1,4 @@ -#' Nudge labels to new positions +#' Nudge or dodge plus nudge labels to new positions #' #' \code{position_dodgenudge_to()} is generally useful for adjusting the #' position of labels or text, both on a discrete or continuous scale. @@ -18,6 +18,10 @@ #' geoms. See the examples. #' @param preserve Should dodging preserve the total width of all elements at a #' position, or the width of a single element?. +#' @param padding Padding between elements at the same position. Elements are +#' shrunk by this proportion to allow space between them. Defaults to 0.1. +#' @param reverse If TRUE, will reverse the default stacking order. This is +#' useful if you're rotating both the plot and legend. #' @param x,y Coordinates of the destination position. A vector of mode #' \code{numeric}, that is extended if needed, to the same length as rows #' there are in \code{data}. The default, \code{NULL}, leaves the original @@ -221,13 +225,14 @@ PositionDodgeNudgeTo <- }, compute_layer = function(self, data, params, layout) { - # operate on the dodged positions - data = ggplot2::ggproto_parent(ggplot2::PositionDodge, self)$compute_layer(data, params, layout) - - x_dodged <- data$x - y_dodged <- data$y x_orig <- data$x y_orig <- data$y + if (!is.na(params$width)) { + # operate on the dodged positions + data = ggplot2::ggproto_parent(ggplot2::PositionDodge, self)$compute_layer(data, params, layout) + } + x_dodged <- data$x + y_dodged <- data$y # compute/convert x nudges if (!length(params$x)) { @@ -235,7 +240,7 @@ PositionDodgeNudgeTo <- if (params$x.action == "none") { params$x <- rep_len(0, nrow(data)) } else if (params$x.action == "spread") { - params$x <- range(x_orig) + params$x <- range(x_dodged) } } else if (is.numeric(params$x)) { # check user supplied x @@ -245,9 +250,9 @@ PositionDodgeNudgeTo <- if (params$x.action == "none") { # recycle or trim x as needed if (params$x.reorder) { - params$x <- rep_len(params$x, nrow(data))[order(order(data$x))] - x_orig + params$x <- rep_len(params$x, nrow(data))[order(order(data$x))] - x_dodged } else { - params$x <- rep_len(params$x, nrow(data)) - x_orig + params$x <- rep_len(params$x, nrow(data)) - x_dodged } } else if (params$x.action == "spread") { params$x <- range(params$x) @@ -263,7 +268,7 @@ PositionDodgeNudgeTo <- # evenly spaced sequence of positions ordered as in data params$x <- seq(from = params$x[1], to = params$x[2], - length.out = nrow(data))[order(order(data$x))] - x_orig + length.out = nrow(data))[order(order(data$x))] - x_dodged } # other strategies to distribute positions could be added here } @@ -274,7 +279,7 @@ PositionDodgeNudgeTo <- if (params$y.action == "none") { params$y <- rep_len(0, nrow(data)) } else if (params$y.action == "spread") { - params$y <- range(y_orig) + params$y <- range(y_dodged) } } else if (is.numeric(params$y)) { # check user supplied y @@ -284,9 +289,9 @@ PositionDodgeNudgeTo <- if (params$y.action == "none") { # recycle or trim y as needed if (params$y.reorder) { - params$y <- rep_len(params$y, nrow(data))[order(order(data$y))] - y_orig + params$y <- rep_len(params$y, nrow(data))[order(order(data$y))] - y_dodged } else { - params$y <- rep_len(params$y, nrow(data)) - y_orig + params$y <- rep_len(params$y, nrow(data)) - y_dodged } } else if (params$y.action == "spread") { params$y <- range(params$y) @@ -301,7 +306,7 @@ PositionDodgeNudgeTo <- # evenly spaced sequence ordered as in data params$y <- seq(from = params$y[1], to = params$y[2], - length.out = nrow(data))[order(order(data$y))] - y_orig + length.out = nrow(data))[order(order(data$y))] - y_dodged } # other strategies could be added here } @@ -318,7 +323,7 @@ PositionDodgeNudgeTo <- data <- transform_position(data, NULL, function(y) y + params$y) } # add original position - if (params$kept.origin == "dodged") { + if (params$kept.origin == "dodged" && !is.na(params$width)) { data$x_orig <- x_dodged data$y_orig <- y_dodged } else if (params$kept.origin == "original") { @@ -350,7 +355,7 @@ position_nudge_to <- y.expansion = 0, kept.origin = c("original", "none")) { - position_dodgenudge_to(width = 1, + position_dodgenudge_to(width = NA_real_, # used as flag to disable dodging preserve = "total", x = x, y = y, diff --git a/R/position-dodge2nudge-to.R b/R/position-dodge2nudge-to.R new file mode 100644 index 0000000..190d1c5 --- /dev/null +++ b/R/position-dodge2nudge-to.R @@ -0,0 +1,195 @@ +#' @rdname position_dodgenudge_to +#' +#' @export +#' +position_dodge2nudge_to <- + function(width = 1, + preserve = c("total", "single"), + padding = 0.1, + reverse = FALSE, + x = NULL, + y = NULL, + x.action = c("none", "spread"), + y.action = c("none", "spread"), + x.distance = "equal", + y.distance = "equal", + x.expansion = 0, + y.expansion = 0, + kept.origin = c("dodged", "original", "none")) { + + stopifnot("'x' must be NULL or of mode numeric" = length(x) == 0 || + (!anyNA(x) && mode(x) == "numeric")) + stopifnot("'y' must be NULL or of mode numeric" = length(y) == 0 || + (!anyNA(y) && mode(y) == "numeric")) + + # this works as long as nudge and mapped variable are of the same class + # ggplot2's behaviour has been in the past and seems to be again to expect + # numeric seconds for POSIXct and numeric days for Date time shifts + if (lubridate::is.instant(x)) { + x <- as.numeric(x) + } + if (lubridate::is.instant(y)) { + y <- as.numeric(y) + } + + ggplot2::ggproto(NULL, PositionDodge2AndNudgeTo, + x = x, + y = y, + x.action = rlang::arg_match(x.action), + y.action = rlang::arg_match(y.action), + x.distance = x.distance, + y.distance = y.distance, + x.expansion = rep_len(x.expansion, 2), + y.expansion = rep_len(y.expansion, 2), + kept.origin = rlang::arg_match(kept.origin), + width = width, + preserve = rlang::arg_match(preserve), + padding = padding, + reverse = reverse + ) + } + +#' @rdname ggpp-ggproto +#' @format NULL +#' @usage NULL +#' @export +PositionDodge2AndNudgeTo <- + ggplot2::ggproto( + "PositionDodge2AndNudgeTo", + Position, + x = NULL, + y = NULL, + + setup_params = function(self, data) { + list(x = self$x, + y = self$y, + x.action = self$x.action, + y.action = self$y.action, + x.distance = self$x.distance, + y.distance = self$y.distance, + x.expansion = self$x.expansion, + y.expansion = self$y.expansion, + x.reorder = !is.null(self$x) && length(self$x) > 1 && length(self$x) < nrow(data), + y.reorder = !is.null(self$y) && length(self$y) > 1 && length(self$y) < nrow(data), + kept.origin = self$kept.origin, + width = self$width, + preserve = self$preserve, + padding = self$padding, + reverse = self$reverse + ) + }, + + compute_layer = function(self, data, params, layout) { + x_orig <- data$x + y_orig <- data$y + if (!is.na(params$width)) { + # operate on the dodged positions + data = ggplot2::ggproto_parent(ggplot2::PositionDodge2, self)$compute_layer(data, params, layout) + } + x_dodged <- data$x + y_dodged <- data$y + + # compute/convert x nudges + if (!length(params$x)) { + # set default x + if (params$x.action == "none") { + params$x <- rep_len(0, nrow(data)) + } else if (params$x.action == "spread") { + params$x <- range(x_dodged) + } + } else if (is.numeric(params$x)) { + # check user supplied x + if (length(params$x) > nrow(data)) { + warning("Argument 'x' longer than data: some values dropped!") + } + if (params$x.action == "none") { + # recycle or trim x as needed + if (params$x.reorder) { + params$x <- rep_len(params$x, nrow(data))[order(order(data$x))] - x_dodged + } else { + params$x <- rep_len(params$x, nrow(data)) - x_dodged + } + } else if (params$x.action == "spread") { + params$x <- range(params$x) + } + } + + if (params$x.action == "spread") { + # apply x.expansion to x + x.spread <- diff(params$x) + params$x[1] <- params$x[1] - params$x.expansion[1] * x.spread + params$x[2] <- params$x[2] + params$x.expansion[2] * x.spread + if (params$x.distance == "equal") { + # evenly spaced sequence of positions ordered as in data + params$x <- seq(from = params$x[1], + to = params$x[2], + length.out = nrow(data))[order(order(data$x))] - x_dodged + } + # other strategies to distribute positions could be added here + } + + # compute/convert y nudges + if (!length(params$y)) { + # set default y + if (params$y.action == "none") { + params$y <- rep_len(0, nrow(data)) + } else if (params$y.action == "spread") { + params$y <- range(y_dodged) + } + } else if (is.numeric(params$y)) { + # check user supplied y + if (length(params$y) > nrow(data)) { + warning("Argument 'y' longer than data: some values dropped!") + } + if (params$y.action == "none") { + # recycle or trim y as needed + if (params$y.reorder) { + params$y <- rep_len(params$y, nrow(data))[order(order(data$y))] - y_dodged + } else { + params$y <- rep_len(params$y, nrow(data)) - y_dodged + } + } else if (params$y.action == "spread") { + params$y <- range(params$y) + } + } + + if (params$y.action == "spread") { + y.spread <- diff(params$y) + params$y[1] <- params$y[1] - params$y.expansion[1] * y.spread + params$y[2] <- params$y[2] + params$y.expansion[2] * y.spread + if (params$y.distance == "equal") { + # evenly spaced sequence ordered as in data + params$y <- seq(from = params$y[1], + to = params$y[2], + length.out = nrow(data))[order(order(data$y))] - y_dodged + } + # other strategies could be added here + } + + # As in 'ggplot2' we apply the nudge to xmin, xmax, xend, ymin, ymax, and yend. + # Transform the dimensions for which not all nudges are zero + if (any(params$x != 0)) { + if (any(params$y != 0)) { + data <- transform_position(data, function(x) x + params$x, function(y) y + params$y) + } else { + data <- transform_position(data, function(x) x + params$x, NULL) + } + } else if (any(params$y != 0)) { + data <- transform_position(data, NULL, function(y) y + params$y) + } + # add original position + if (params$kept.origin == "dodged" && !is.na(params$width)) { + data$x_orig <- x_dodged + data$y_orig <- y_dodged + } else if (params$kept.origin == "original") { + data$x_orig <- x_orig + data$y_orig <- y_orig + } + + data + }, + + compute_panel = function(self, data, params, scales) { + ggplot2::ggproto_parent(PositionDodge2, self)$compute_panel(data, params, scales) + } + ) diff --git a/R/position-jitter-nudge.R b/R/position-jitter-nudge.R index 81c8048..607ab97 100644 --- a/R/position-jitter-nudge.R +++ b/R/position-jitter-nudge.R @@ -235,7 +235,7 @@ PositionJitterAndNudge <- x_orig <- data$x y_orig <- data$y - # operate on the dodged positions + # operate on the jittered positions data = ggplot2::ggproto_parent(ggplot2::PositionJitter, self)$compute_layer(data, params, layout) x_jittered <- data$x diff --git a/man/ggpp-ggproto.Rd b/man/ggpp-ggproto.Rd index 24d75ad..d80e609 100644 --- a/man/ggpp-ggproto.Rd +++ b/man/ggpp-ggproto.Rd @@ -4,11 +4,12 @@ % R/geom-margin-grob.r, R/geom-margin-point.r, R/geom-plot.R, % R/geom-point-linked.r, R/geom-quadrant-lines.R, R/geom-table.R, % R/geom-text-linked.r, R/geom-text-npc.r, R/geom-text-pairwise.R, -% R/position-dodge-nudge-to.R, R/position-nudge-center.R, -% R/position-nudge-line.R, R/position-stack-nudge.R, R/stat-apply.R, -% R/stat-dens1d-filter.r, R/stat-dens1d-labels.r, R/stat-dens2d-filter.r, -% R/stat-dens2d-labels.r, R/stat-format-table.R, R/stat-functions.R, -% R/stat-panel-counts.R, R/stat-quadrant-counts.R +% R/position-dodge-nudge-to.R, R/position-dodge2nudge-to.R, +% R/position-nudge-center.R, R/position-nudge-line.R, +% R/position-stack-nudge.R, R/stat-apply.R, R/stat-dens1d-filter.r, +% R/stat-dens1d-labels.r, R/stat-dens2d-filter.r, R/stat-dens2d-labels.r, +% R/stat-format-table.R, R/stat-functions.R, R/stat-panel-counts.R, +% R/stat-quadrant-counts.R \docType{data} \name{GeomGrob} \alias{GeomGrob} @@ -33,6 +34,7 @@ \alias{GeomTextNpc} \alias{GeomTextPairwise} \alias{PositionDodgeNudgeTo} +\alias{PositionDodge2AndNudgeTo} \alias{PositionNudgeCenter} \alias{PositionNudgeLine} \alias{PositionFillAndNudge} diff --git a/man/position_dodgenudge_to.Rd b/man/position_dodgenudge_to.Rd index 2056109..e64aaa2 100644 --- a/man/position_dodgenudge_to.Rd +++ b/man/position_dodgenudge_to.Rd @@ -1,9 +1,11 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/position-dodge-nudge-to.R +% Please edit documentation in R/position-dodge-nudge-to.R, +% R/position-dodge2nudge-to.R \name{position_dodgenudge_to} \alias{position_dodgenudge_to} \alias{position_nudge_to} -\title{Nudge labels to new positions} +\alias{position_dodge2nudge_to} +\title{Nudge or dodge plus nudge labels to new positions} \usage{ position_dodgenudge_to( width = 1, @@ -30,6 +32,22 @@ position_nudge_to( y.expansion = 0, kept.origin = c("original", "none") ) + +position_dodge2nudge_to( + width = 1, + preserve = c("total", "single"), + padding = 0.1, + reverse = FALSE, + x = NULL, + y = NULL, + x.action = c("none", "spread"), + y.action = c("none", "spread"), + x.distance = "equal", + y.distance = "equal", + x.expansion = 0, + y.expansion = 0, + kept.origin = c("dodged", "original", "none") +) } \arguments{ \item{width}{Dodging width, when different to the width of the individual @@ -57,6 +75,12 @@ fraction of width of the range.} \item{kept.origin}{One of \code{"original"}, \code{"dodged"} or \code{"none"}.} + +\item{padding}{Padding between elements at the same position. Elements are +shrunk by this proportion to allow space between them. Defaults to 0.1.} + +\item{reverse}{If TRUE, will reverse the default stacking order. This is +useful if you're rotating both the plot and legend.} } \value{ A \code{"Position"} object. diff --git a/tests-not/test-dodgenudge-to.R b/tests-not/test-dodgenudge-to.R index d894dea..c4420de 100644 --- a/tests-not/test-dodgenudge-to.R +++ b/tests-not/test-dodgenudge-to.R @@ -20,7 +20,7 @@ data %>% geom_line(position = position_dodge(width = .3))+ geom_text_repel(data= data_labels, aes(label = group), - position = position_dodgenudge_to(width = .3, x = .8, kept.origin = "dodged"), + position = position_dodgenudge_to(width = .3, x = .8), direction = "y", hjust = "right", size = 3, diff --git a/tests/testthat/Rplots.pdf b/tests/testthat/Rplots.pdf index 9b1de6e..ea766c4 100644 Binary files a/tests/testthat/Rplots.pdf and b/tests/testthat/Rplots.pdf differ diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-contract-expand-x1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-contract-expand-x1.svg new file mode 100644 index 0000000..3ee90f0 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-contract-expand-x1.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + + + +1 +2 +3 +4 +5 +x +y +nudge_to_contract_expand_x1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-contract-expand-y1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-contract-expand-y1.svg new file mode 100644 index 0000000..9dcee95 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-contract-expand-y1.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + +2 +4 +6 +x +y +nudge_to_contract_expand_y1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-contract-x1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-contract-x1.svg new file mode 100644 index 0000000..0838032 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-contract-x1.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + + + +1 +2 +3 +4 +5 +x +y +nudge_to_contract_x1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-contract-y1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-contract-y1.svg new file mode 100644 index 0000000..800f7ea --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-contract-y1.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 + + + + + + + +2 +4 +6 +x +y +nudge_to_contract_y1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-expand-x1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-expand-x1.svg new file mode 100644 index 0000000..ad3c646 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-expand-x1.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + + + +1 +2 +3 +4 +5 +x +y +nudge_to_expand_x1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-expand-x1y1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-expand-x1y1.svg new file mode 100644 index 0000000..4c379fd --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-expand-x1y1.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 + + + + + + + + + +1 +2 +3 +4 +5 +x +y +nudge_to_expand_x1y1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-expand-x2.svg b/tests/testthat/_snaps/position-nudge/nudge-to-expand-x2.svg new file mode 100644 index 0000000..f2dcf10 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-expand-x2.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + + + +1 +2 +3 +4 +5 +x +y +nudge_to_expand_x2 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-expand-y1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-expand-y1.svg new file mode 100644 index 0000000..9ffcb41 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-expand-y1.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + +2 +4 +6 +x +y +nudge_to_expand_y1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-expand-y2.svg b/tests/testthat/_snaps/position-nudge/nudge-to-expand-y2.svg new file mode 100644 index 0000000..74c9cf4 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-expand-y2.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + +2 +4 +6 +x +y +nudge_to_expand_y2 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-spread-x1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-spread-x1.svg new file mode 100644 index 0000000..7de2614 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-spread-x1.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + + + +1 +2 +3 +4 +5 +x +y +nudge_to_spread_x1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-spread-x1y1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-spread-x1y1.svg new file mode 100644 index 0000000..b6efdba --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-spread-x1y1.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 + + + + + + + + + +1 +2 +3 +4 +5 +x +y +nudge_to_spread_x1y1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-spread-x2.svg b/tests/testthat/_snaps/position-nudge/nudge-to-spread-x2.svg new file mode 100644 index 0000000..ad70e26 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-spread-x2.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + + + +1 +2 +3 +4 +5 +x +y +nudge_to_spread_x2 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-spread-y1.svg b/tests/testthat/_snaps/position-nudge/nudge-to-spread-y1.svg new file mode 100644 index 0000000..896d87f --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-spread-y1.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 + + + + + + + +2 +4 +6 +x +y +nudge_to_spread_y1 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to-spread-y2.svg b/tests/testthat/_snaps/position-nudge/nudge-to-spread-y2.svg new file mode 100644 index 0000000..5211414 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to-spread-y2.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 +3.0 + + + + + + + + +2 +4 +6 +x +y +nudge_to_spread_y2 + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to1a.svg b/tests/testthat/_snaps/position-nudge/nudge-to1a.svg new file mode 100644 index 0000000..a102794 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to1a.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1 +2 +3 +4 + + + + + + + + + +1 +2 +3 +4 +5 +x +y +nudge_to1a + + diff --git a/tests/testthat/_snaps/position-nudge/nudge-to2.svg b/tests/testthat/_snaps/position-nudge/nudge-to2.svg new file mode 100644 index 0000000..84bf7a6 --- /dev/null +++ b/tests/testthat/_snaps/position-nudge/nudge-to2.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +abc + +cd + +d + +c + +bcd + +a + + + +1.0 +1.5 +2.0 +2.5 + + + + + + + +2 +4 +6 +x +y +nudge_to2 + +