r中gglot怎么组合多张图_ggplot2绘图:多张图合并为一张

以下内容来自教程

R语言中多张图画到同一个页面上常用的函数为par()和layout()

par()函数详解

layout()函数的简单使用

但是这两个函数不适用于ggplot2;ggplot2作图如果希望把多张图放到同一个页面上基本的解决办法是使用(The basic solution is to use the gridExtra R package),主要的两个函数为grid.arrange(),arrangeGrob();然而这两个函数都有各自的缺点(说明缺点的英文暂时还没有看懂)

these functions makes no attempt at aligning the plot panels; instead, the plots are simply placed into the grid as they are, and so the axes are not aligned.

为了解决这个问题,可以使用cowplot这个Rpackage,其中包括一个函数plot_grid();然而这个包也有一个缺点

the cowplot package doesn’t contain any solution for multi-pages layout

所以就有了ggpubr包中的ggarrange()函数

a wrapper around the plot_grid() function(wrapper是什么意思呢?)

to arrange multiple ggplots over multiple pages

it can also create a common unique legend for multiple plots.

第一步安装

两种方式可以选择

1

library(devtools)

instal

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值