r - 在 R 中使用 PreSummarized 数据创建 BoxPlot
解决方案
这个怎么样:
dat <- data.frame(
Mean_Cost = c(300, 760, 500),
Std = c(20,55,100),
Median_Cost = c(200, 222, 467),
LowerIQR = c(150, 100, 333),
UpperIQR = c(220, 300, 500),
Group = c(1,2,3))
ggplot(dat, aes(xmin = Group-.25, xmax=Group+.25, ymin=LowerIQR, ymax=UpperIQR)) +
geom_rect(fill="transparent", col = "black") +
geom_segment(aes(y=Median_Cost, yend=Median_Cost, x=Group-.25, xend=Group+.25)) +
scale_x_continuous(breaks=1:3, labels=c("Group 1", "Group 2", "Group 3")) +
theme_classic() +
labs(x="", y="Cost")
推荐阅读
- amazon-web-services - 使用 AWS Lambda 函数和 Amazon S3 事件 (JAVA) 创建文件
- python - 来自两个父母的遗产
- spring - Spring 按页面值排序
- regex - 我可以使用正则表达式来指定与正确数量的左括号和右括号匹配的模式吗?
- vba - VBA hide and show sheets based on YES/NO and worksheet name
- html - 如何在 Angular 中创建一个带有不同颜色的左右段落的框?
- android - 如何在 Espresso kotlin 中实现 UI 测试的倒计时?
- python - 使用 cfgrib 加载具有“未知”typeOfLevel 的 GRIB 变量
- javascript - 无法在新打开的窗口 JS 上访问文档
- pine-script - 同时进行多头和空头交易的 Pine Script 策略