作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 ggplot 中,我们可以通过指定数据框中具有条形高度的列来创建条形图
library("ggplot2")
library(plyr)
mm <- ddply(mtcars, "cyl", summarise, mmpg = mean(mpg))
ggplot(mm, aes(x = factor(cyl), y = mmpg)) + geom_bar(stat = "identity")
df <- read.table(text = " id min max
Sp1 8.5 13.2
Sp2 11.7 14.5
Sp3 14.7 17.7 ", header=TRUE)
最佳答案
您可以使用 geom_crossbar
:
ggplot(df) +
geom_crossbar(aes(ymin = min, ymax = max, x = id, y = min),
fill = "blue", fatten = 0)
关于r - 如何仅基于最小值和最大值创建箱线图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21560861/
我是一名优秀的程序员,十分优秀!