[英]Trouble with notches ggplot2
I am attempting to create a notched boxplot in ggplot2, thus: 我正在尝试在ggplot2中创建一个缺口箱形图,因此:
m <- ggplot(dat, aes(y = Slope, x = factor(BB),
fill=factor(BB)))
m + geom_boxplot(notch = TRUE)
However the plot produced is just a normal boxplot without notches. 但是,生成的图只是没有槽口的普通箱线图。 Has anyone encountered this issue before?
有人遇到过这个问题吗? Is there a way around it?
有办法解决吗? I'm not sure if i'm missing something really obvious here!
我不确定在这里是否遗漏了一些明显的东西!
I cna't put my own data up but I am getting the same result with the example dataset from ggplot2: 我没有提交自己的数据,但是从ggplot2的示例数据集获得了相同的结果:
p <- ggplot(mtcars, aes(factor(cyl), mpg))
p + geom_boxplot(notch = TRUE, notchwidth = .3)
My session info is: 我的会话信息是:
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] splines grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] mgcv_1.7-6 gam_1.06.2 caper_0.5 mvtnorm_0.9-9991 MASS_7.3-13 ape_3.0-1
[7] ggplot2_0.8.9 proto_0.3-9.2 reshape_0.8.4 plyr_1.7.1
loaded via a namespace (and not attached):
[1] digest_0.5.1 gee_4.13-17 lattice_0.19-33 Matrix_0.999375-50 nlme_3.1-101
[6] tools_2.13.1
I suppose that your problem is because you are using an older version of ggplot2. 我想您的问题是因为您使用的是ggplot2的旧版本。 Noting @joran's comment, I'd also recommend to update R first before updating packages.
注意到@joran的评论,我还建议先更新R,然后再更新软件包。
Then, you can install/update ggplot2
and all its dependencies by: 然后,您可以通过以下方式安装/更新
ggplot2
及其所有依赖项:
install.packages("ggplot2", dependencies = TRUE)
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.