# geom_xspline: position offset for overlapping lines

Solution for geom_xspline: position offset for overlapping lines
is Given Below:

I’m trying to plot a smooth line between points for 3 different groups of values:

``````test <-  data.frame(treatment_group = as_factor(c("control",
"Fgf8+_wk3-wk4",
"Fgf8+_wk3-wk5",
"Fgf8+_wk3-wk7")),
ACTB = c(1.00,1.12,7.07,0.74),
GAPDH = c(1.00,1.15,7.38,0.83),
AVERAGE = c(1.00,1.10,7.22,0.78)
)
``````

Using `geom_xspline` as suggested here works well – however, in this specific case, the lines are almost completely coincident at several points.

``````ggplot(df,
aes(x = treatment_group, y = value,
group = relative_to, colour = relative_to)) +
geom_point() +
geom_xspline(aes(x = treatment_group, y = value,
group = relative_to, color = relative_to),
spline_shape = -0.5,
size = 0.5) +
theme_minimal()
`````` Trying to offset the points and spline produces weird results, and I can’t figure out how to correct this:

``````  ggplot(test,
aes(x = treatment_group, y = value,
group = relative_to, colour = relative_to)) +
geom_point(position = position_dodge(preserve = "total",  width = 0.5)) +
geom_xspline(aes(x = treatment_group, y = value,
group = relative_to, color = relative_to),
# rep_ends = TRUE,
spline_shape = -0.5,
df = 4,
size = 0.5,
all_knots = TRUE,
position = position_dodge(preserve = "total", width = 0.5)) +

#  spar = 0.1, tol = 1
theme_minimal()
`````` I’ve tried other `position()` settings but none of them get rid of the jagged line in the first segment. Any clues are greatly appreciated.

``````position = position_jitterdodge(dodge.width = 0.25)) +
position = position_stack(vjust = 0.1)) +
``````