I am looking for a solution to order the pathway of geom_path based on a defined order set to a factor.
I have been working with the fist two PCA dimensions. Using library("factoextra")
and library("FactoMineR")
I generate my figure with fviz_pca_ind()
.
raa_male <- fviz_pca_ind(
pca.data,
fill.ind = male_raa.df$Season,
pointsize = male_raa.df$BRI,
pointshape = 21,
repel = TRUE
)
The data is arranged in to individuals (shown by text labels).
Using geom_path
I want to connect points of the same individual, by order the path way the factor season, c(Autumn, Winter, Spring)
. However I am having difficulty doing this
male_raa.df$Season <- factor(male_raa.df$Season, levels = c("Autumn", "Winter", "Spring"))
raa_male +
geom_path(
arrow = arrow(angle = 15, ends = "last", type = "closed"),
alpha = 0.2,
aes(group = male_raa.df$TagID)
)
The ordering set to factor does not appear translating to ordering of the geom_path pathway.