Skip to content

Commit

Permalink
Fix bug and one more arg_match()
Browse files Browse the repository at this point in the history
  • Loading branch information
aphalo committed Feb 20, 2023
1 parent ba24de2 commit bf4a96f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion R/geom-point-linked.r
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ GeomPointS <-
segment.linewidth = 0.5,
min.segment.length = 0,
add.segments = FALSE) {

if (is.character(data$shape)) {
data$shape <- ggplot2::translate_shape_string(data$shape)
data$shape <- translate_shape_string(data$shape)
}

if (nrow(data) == 0L) {
Expand Down
12 changes: 8 additions & 4 deletions R/stat-quadrant-counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ stat_quadrant_counts <- function(mapping = NULL,
geom = "text_npc",
position = "identity",
quadrants = NULL,
pool.along = "none",
pool.along = c("none", "x", "y", "xy"),
xintercept = 0,
yintercept = 0,
label.x = NULL,
Expand All @@ -138,9 +138,13 @@ stat_quadrant_counts <- function(mapping = NULL,
show.legend = FALSE,
inherit.aes = TRUE, ...) {

stopifnot(pool.along %in% c("none", "x", "y"))
stopifnot(length(xintercept) == 1 && length(yintercept) == 1)
stopifnot(length(quadrants) <= 4)
pool.along <- rlang::arg_match(pool.along)
if (!is.null(pool.along) && pool.along == "xy") {
quadrants <- 0L # consistent UI with other stats from 'ggpp'
}
stopifnot("'xintercept' should have length == 1L" = length(xintercept) <= 1,
"'yintercept' should have length == 1L" = length(yintercept) <= 1)
stopifnot("Length of 'quadrants' shoul be between 0 and 4" = length(quadrants) <= 4)
stopifnot(is.null(label.x) || is.numeric(label.x) || is.character(label.x))
stopifnot(is.null(label.y) || is.numeric(label.y) || is.character(label.y))

Expand Down
2 changes: 1 addition & 1 deletion man/stat_quadrant_counts.Rd

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

Binary file modified tests/testthat/Rplots.pdf
Binary file not shown.

0 comments on commit bf4a96f

Please sign in to comment.