-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorpositions 🥇tidy-dev-day 🤓Tidyverse Developer DayTidyverse Developer Day
Description
When geom_jitter is given some data where the y coordinates are all the same, a default jitter height is chosen. But if the y coordinates differ only by a small magnitude, the selection of the jitter height seems to fail and nothing is plotted.
Minimal working example:
library(ggplot2)
set.seed(123)
ggplot(data.frame(x = 1:50, y = 0)) +
geom_jitter(aes(x, y))
set.seed(123)
ggplot(data.frame(x = 1:50, y = 1e-8 * rnorm(50))) +
geom_jitter(aes(x, y))
#> Warning in min(d[d > tolerance]): no non-missing arguments to min; returning
#> Inf
#> Warning in stats::runif(length(x), -amount, amount): NAs produced
#> Warning: Removed 50 rows containing missing values or values outside the scale range
#> (`geom_point()`).
Created on 2025-07-25 with reprex v2.1.1
I would have expected both plots to be more or less the same.
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorpositions 🥇tidy-dev-day 🤓Tidyverse Developer DayTidyverse Developer Day