I have a data that is of a "grid" structure and I wish to connect certain points together according to a group variable. geom_line()
can achieve this (see below), but I want to get those lines to be curved. How could this be done? geom_curve()
does not seem compatible with this particular data format. Thank you.
df = data.frame(
x = factor(c(1,1,2,2)),
y = factor(c(1,2,1,2)),
group = c("A","A","B","B"))
df %>%
ggplot(aes(x = x, y = y)) +
geom_point() +
geom_line(aes(group = group))