【发布时间】:2013-05-25 03:40:37
【问题描述】:
我正在尝试创建一个 geom_bar:
<<boring-plots, fig.width=5, fig.height=5, out.width='.45\\linewidth',fig.show='hold', echo=FALSE, warning=FALSE>>=
ma_at_vs_t_duh + geom_bar(stat="bin", fill="white", colour="darkgreen", width=.4) + ggtitle("Anzahl MA nach Vertragsart, \nMandant 10 und 50") +
theme(plot.title = element_text(lineheight=.6, face="bold")) +
xlab("Vertragsart") +
ylab("Anzahl MA") +
theme(axis.title.x = element_text(vjust=0.5, size=14), axis.text.x=element_text(size=10)) +
stat_bin(aes(label=..count..), geom="text", size=4, vjust=-0.5)
@
编译 Rnw 文件后,我得到了 pdf 输出文件:
ymax not defined: adjusting position using y instead
如果有任何帮助,我将不胜感激。谢谢!
【问题讨论】:
-
警告/消息来自 ggplot 并且是无害的。我不记得确切地为什么会发生或如何抑制它(
suppressMessages()?在knitr块选项中设置message=FALSE?,但我经常看到它) -
...并在 knitr 块选项中设置
warning = FALSE通常对我有用。 -
warning=FALSE 在 knitr "3.0.1" 的 R 版本 3.0.2 (2013-09-25) 中似乎不起作用
-
设置knitr块选项
warning=FALSE对我不起作用,但message=FALSE。 OS X 上的 knitr_1.10.5 和 R 版本 3.2.0