R语言中控制绘图面板中绘图数目
1、一般绘图
> plot(0:10)
2、利用mfrow参数设置
par(mfrow = c(1,2)) ## 设置为一行两列 plot(0:10) plot(0:10)
> dev.off() ## 清空设置 null device 1
> par(mfrow = c(1,4)) ## 设置为1行4列 > plot(0:10) > plot(0:10) > plot(0:10) > plot(0:10) > dev.off() ## 清空设置 null device 1
> par(mfrow = c(2,4)) ## 设置为2行4列 > plot(0:10) > plot(0:10) > plot(0:10) > plot(0:10) > plot(0:10) > plot(0:10) > plot(0:10) > plot(0:10) > dev.off() ##关闭绘图 null device 1
3、利用mfrow VS mfcol
mfrow:先行后列
> par(mfrow = c(2,2)) ## 设置为两行两列 > plot(0:10, main = "1111") > plot(0:10, main = "2222") > plot(0:10, main = "3333") > plot(0:10, main = "4444") > dev.off() ## 关闭绘图 null device 1
mfcol: 先列后行
> par(mfcol = c(2,2)) > plot(0:10, main = "1111") > plot(0:10, main = "2222") > plot(0:10, main = "3333") > plot(0:10, main = "4444") > dev.off() null device 1