我試圖用gglot將使用grid.text製作的註釋製作的數字保存到使用ggsave的tiff中。但是,ggsave不包含註釋。我嘗試使用grid.arrange和arrangeGrob(如以前的帖子中所建議的),但它表示既沒有找到函數。自從發佈這些答案以後,似乎對這些軟件包進行了一些更改?ggsave()帶註釋後的ggplot()
{r} require(reshape2) require(lsr) require(ggplot2) require(ez) require(grid) require(gridExtra) source("summarySE.R")
{r} AggregateBW2 = summarySE(AggregateBW1, measurevar="BW", groupvars=c("Cond","Iso","within")) figure = ggplot(AggregateBW2, aes(x=Cond, y=BW, group=within)) + geom_bar(position=position_dodge(), stat="identity", fill="#999999", colour="black") + facet_grid(Iso ~ .) + geom_errorbar(aes(ymin=BW-se, ymax=BW+se), width=.2, position=position_dodge(.9)) + scale_x_discrete(name="Surgical condition") + scale_y_continuous(name="Body Weight (g)") + theme(axis.text.x=element_text(size=18), axis.text.y=element_text(size=18), axis.title.x=element_text(size=22), axis.title.y=element_text(size=22), strip.text.y=element_text(size=18)) #+ grid.text(unit(.985,"npc"),0.5,label = "Isoflurane Percentage", rot = 270, gp=gpar(fontsize=22), check=TRUE) paperfigure = grid.arrange(figure, ncol = 1, bottom = "footnote") ggsave(file="newbodyweight-final.tiff", paperfigure)
請詳細說明這個答案。 – ppovoski