r - 订购 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”更改订单,我应该怎么做?
解决方案
推荐阅读
- r-markdown - RMarkdown - 更改内联代码颜色 *无需更改工作流程*
- javascript - 如何编写不需要重置状态的单元测试?
- cmake - 如何使用 CMake 将 C++REST SDK 添加为子模块?
- ruby-on-rails - 已安装 Rails 但无法运行?
- php - php 中哪个库最适合发出异步请求
- php - 为我的 php 应用程序(社交应用程序)创建 API 版本控制
- angular - 对于使用 ngrx 以状态存储的数组来说有多大?
- arrays - 致命错误:追加数组时数组索引超出范围
- azure - 一个 Timer 触发器类中的多个 Azure Functions
- java - 没有选择的百里香选项