I did encounter those known issues regarding the ordering of factors as mentioned by @mnel. I tried geom_path
mentioned by @mnel and
Matt Bannert, and it works beautifully!
for example, in df1
, W, X, and Z are factors, Y is numerical. df1
is sorted by Z
ggplot(df1,aes(X,Y))+
geom_path(alpha=0)+ # w/o this line, points are not plotted in their order in df1
geom_jitter(aes(color=Z,fill=Z))+
facet_wrap('W')