You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With ggplot2::geom_path, setting group = _y_ in the aesthetic mapping connects observations with the same value for y. For example, I am visualizing the paths taken by agents in a 2D environment, where I want to stratify paths by a unique agent ID. However, when I try to to use this argument in geom_link2 I receive the error:
Warning message:
Computation failed in `stat_link2()`.
Caused by error in `data.frame()`:
! arguments imply differing number of rows: 2, 0
A minimal working example using the reference:
lines <- data.frame(
x = c(5, 12, 15, 9, 6),
y = c(17, 20, 4, 15, 5),
xend = c(19, 17, 2, 9, 5),
yend = c(10, 18, 7, 12, 1),
width = c(1, 10, 6, 2, 3),
group = c("a", "a", "b", "b", "c")
ggplot(lines) +
geom_link2(aes(x = x, y = y, colour = colour, size = width, group = group),
lineend = 'round', n = 500)
)
In fact, this works when setting group to any of the columns. It seems to work only if there are at least 2 observation in each group and the same number of observations across groups (2 <= N_i == N_(-i)).
Is this expected, and is there a way to achieve groups as in geom_path?
The text was updated successfully, but these errors were encountered:
With
ggplot2::geom_path
, settinggroup = _y_
in the aesthetic mapping connects observations with the same value for y. For example, I am visualizing the paths taken by agents in a 2D environment, where I want to stratify paths by a unique agent ID. However, when I try to to use this argument ingeom_link2
I receive the error:A minimal working example using the reference:
In fact, this works when setting
group
to any of the columns. It seems to work only if there are at least 2 observation in each group and the same number of observations across groups (2 <= N_i == N_(-i)).Is this expected, and is there a way to achieve groups as in
geom_path
?The text was updated successfully, but these errors were encountered: