我在 R 中有以下数据框,目前有以下 ggplot。
means.df <- data.frame(means,columnnames,coltype)
p1 <- ggplot(means.df, aes(x=means,y=columnnames,color=factor(coltype) )) +
geom_point() + scale_color_manual(values=c("blue", "red", "black"))
现在我的情节根据因子“coltype”正确着色,但仍按字母顺序排列。我想根据“coltype”因素更改顺序,我该怎么做?