The dataset mite
, was sampled across five sites for 12 months. I have a PCA plot as follows. I want to draw a "time trajectory" such that for every site, there are 11 points that are connected starting from 1 and ending at month 12. I know I can do this using geom_path but I am not sure how can I do that?
library(ggfortify)
# Load mite species abundance data
data("mite")
df.mite <- mite
df.mite <- df.mite[c(1:60),]
df.mite$site <- rep(c("A","B","C","D","E"), each = 12)
df.mite$month <- rep(c(1:12), times = 5)
# Load environmental data
data("mite.env")
df.mite.env <- mite.env[c(1:60),]
# Hellinger transform the community data
mite.spe.hel <- decostand(df.mite, method = "hellinger")
# Standardize quantitative environmental data
df.mite.env$SubsDens <- decostand(df.mite.env$SubsDens, method = "standardize")
df.mite.env$WatrCont <- decostand(df.mite.env$WatrCont, method = "standardize")
mite.spe.rda.signif <- rda(mite.spe.hel ~ WatrCont + Shrub +
Substrate + Topo + SubsDens, data = df.mite.env)
sc_si <- scores(mite.spe.rda.signif, display="sites", choices=c(1,2), scaling=1)
ggplot(sc_si, aes(x=RDA1, y=RDA2)) + geom_point(aes(shape=df.mite$site, colour=as.factor(df.mite$month)),size = 5) +
geom_hline(yintercept=0, linetype="dotted") +
geom_vline(xintercept=0, linetype="dotted") +
coord_fixed() +
theme_classic() +
scale_shape_manual(values=c(16,16,17,17,15))