r - 在R中将多个箱线图分组在同一个图中
问题描述
我试图在与“expertA”相同的图表中获得“expertB”的箱线图,但 y 轴应该保持 1、2、3、4、5、6 而不是 1,直到 12。颜色似乎也出错了,他们需要分开:专家A的一种颜色和专家B的另一种颜色。感谢帮助!
这是我的代码:
a <- dataset2010$`#ExpertA`
b <- dataset2010$`#ExpertB`
expA <- list(a[1:3],a[4:6],a[7:9],a[10:12],a[13:15],a[16:18])
expB <- list(b[1:3],b[4:6],b[7:9],b[10:12],b[13:15],b[16:18])
expAll <- c(expA, expB)
#Boxplot results expert A:
boxplot(expA, col=(c("lightblue")),
main= "Expert A", xlab ="Estimated value", ylab = "Question",
horizontal = TRUE)
#Boxplot results expert B:
boxplot(expB, col=(c("lightgrey")),
main= "Expert B", xlab ="Estimated value", ylab = "Question",
horizontal = TRUE)
#Trying to combine the boxplots:
boxplot(expAll, col=(c("lightblue", "lightgrey")), #"lightgreen", "yellow"
main= "Expert ", xlab ="Estimated value", ylab = "Question",
horizontal = TRUE)
解决方案
推荐阅读
- ruby-on-rails - 在 rails 目录中启动 sidekiq 和使用 fork 在现有 rails 进程(如控制台)中启动 sidekiq 有什么区别
- jquery - 如何在不使用 jquery 删除哈希的情况下更改动态创建的 href 值的字符
- python - 烧瓶python在循环时制作后台线程
- mysql - 通过 mysql odbc 驱动程序 3.51 的 vb6 代码创建 DSN 在 Windows 64 位中不起作用
- php - 检查两个数字是否设置了相同的位
- react-native - React Native 版本不匹配,无法在 Xcode 中重建
- javascript - 如何获取触发 change() 函数并使用它打开其模式的选择选项的数据值?
- javascript - 如何确保用户在 HTML 表单输入中输入有效的正则表达式?
- asp.net - 如何在 asp.net 中将数据库表中的大数据下载到 CSV 文件
- uwp - Window Application提交提取导入API信息失败