标签:
require(ggplot2) require(Cairo) require(grid) p = ggplot(iris,aes(x = Species,y = Sepal.Length,colour = Species)) p+geom_point() a = p+geom_point() b = qplot(Sepal.Length,Petal.Length,data=iris,geom="point",colour = Species) c = qplot(Species,Sepal.Width,data=iris,geom="boxplot",fill = Species) #创建新的画图页面 grid.newpage() pushViewport(viewport(layout = grid.layout(2,2))) vplayout = function(x,y)viewport(layout.pos.row = x,layout.pos.col = y) print(a,vp = vplayout(1,1:2)) print(b,vp = vplayout(2,1)) print(c,vp = vplayout(2,2)) ggsave("test_layout.pdf",width = 8,height = 6) dev.off()
标签:
原文地址:http://www.cnblogs.com/yangk/p/4761470.html