ggplot一页多图函数multiplot

ggplot一页多图函数multiplot

ggplot有Facet(分面)功能,但那个多图是根据分组信息实现。如果想一页多个不相干的图,可用Multiplot这个函数。具体做法是,将如下代码存为R script:

# Multiple plot function
#
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
# - cols:   Number of columns in layout
# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
#
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
# then plot 1 will go in the upper left, 2 will go in the upper right, and
# 3 will go all the way across the bottom.
#
multiplot

调用时将其source即可。


除非特别声明,文章均为牛会飞的博客原创,遵循署名-非商业使用-相同方式共享授权协议
转载请注明出处: https://blogfei.com/ggplot-multiplot-fanction/

暂无评论