-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorpositions 🥇
Description
In the example below, ranges 1, 2, 3 all overlap and hence should get the same overlap identifier from find_x_overlaps()
.
However, range 3 is counted separately, despite having 100% overlap with range 1.
library(ggplot2)
f <- function(x, xend) ggplot2:::find_x_overlaps(data.frame(xmin = x, xmax = xend))
df <- data.frame(
xmin = c(1, 2, 3, 5),
xmax = c(4, 3, 4, 6),
group = factor(1:4)
)
ggplot(df, aes(x = xmin, xend = xmax, y = group)) +
geom_segment(aes(colour = factor(f(xmin, xmax))))
Consequentially, position_dodge2()
does not actually dodge range 3 from 1 & 2:
ggplot(df, aes(xmin = xmin, xmax = xmax)) +
geom_rect(aes(ymin = 0, ymax = 1, fill = group),
alpha = 0.75,
position = position_dodge2())
Created on 2024-06-07 with reprex v2.1.0
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorpositions 🥇