R 当ymax超过Y轴比例时,错误条渲染不正确

R 当ymax超过Y轴比例时,错误条渲染不正确,r,ggplot2,R,Ggplot2,我想通过在缩放Y\u连续中使用限制来“裁剪”Y轴: df1 <- data.frame(xx=c('a','b','c'), yy=c(7, 10, 8), se=c(2, 4, 2)) p <- ggplot(data=df1, mapping = aes(x=xx, y=yy)) + geom_bar(data = df1, position=position_dodge(), stat="identi

我想通过在
缩放Y\u连续
中使用
限制来“裁剪”Y轴:

df1 <- data.frame(xx=c('a','b','c'),
                  yy=c(7, 10, 8),
                  se=c(2, 4, 2))
p <- ggplot(data=df1, mapping = aes(x=xx, y=yy)) + 
  geom_bar(data = df1, position=position_dodge(), stat="identity") +
  geom_errorbar(aes(ymin=yy-se, ymax=yy+se), width=0.1, position=position_dodge())

p # left plot

p + scale_y_continuous(limits=c(0,11)) # middle plot
# Warning message:
# Removed 4 rows containing missing values (geom_path).
df1我相信

library("scales")
p + scale_y_continuous(limits=c(0,11),oob=squish)
将这样做(未测试);“oob”代表“出界”

更标准的答案是使用

coord_cartesian(ylim=c(0,11))
但这也会改变刻度间距等。

太好了,谢谢!(
oob=squish
对我不起作用,但
oob=rescale\u none
完成了工作)