订购 ggplot 轴和颜色

时间:2021-06-08 13:55:11

标签: r ggplot2

我在 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”因素更改顺序,我该怎么做?

0 个答案:

没有答案