Open mtorchiano opened 4 years ago
Just realized that there is a simple workaround.
The problem is very likely due to the use of line
instead of path
as the basic geom.
The workaround consists in forcing explicitly the use of geom_path
by using stat_xspline
instead of geom_xspline
:
ggplot(d.test,aes(x=GDP,y=GINI))+
stat_xspline(geom="path")+
geom_point(color="red")
There is a bug in the implementation of
geom_xspline
that produce a jittered line.Looks like the result is rendered similarly to a
geom_line
rather than ageom_path
.The interpolation halfway 3rd and 4th points start going up and down between expected line and the 5th (and last) point.
As a comparison the equivalent interpolation line from
xspline
is correct:As a further check we can superimpose the
xspline
interpolation on thegeom_xspline
to see the result:Session information: