我正在寻找一种解决方案,以根据设置为因子的定义顺序对 geom_path 的路径进行排序。
我一直在使用前两个 PCA 维度。使用library("factoextra")
andlibrary("FactoMineR")
我用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
)
数据按个人排列(由文本标签显示)。
使用geom_path
我想连接同一个人的点,按因子季节的路径顺序,c(Autumn, Winter, Spring)
. 但是我很难做到这一点
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)
)
设置为因子的排序似乎不会转化为 geom_path 路径的排序。