首页 > 解决方案 > 订购 ggplot 轴和颜色

问题描述

我在 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”更改订单,我应该怎么做?

标签: rggplot2

解决方案


推荐阅读