我试图用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