R 的图形组合、图形布局的精细控制| 学习笔记

简介: 快速学习 R 的图形组合、图形布局的精细控制

开发者学堂课程【大数据之 R 语言速成与实战R的图形组合、图形布局的精细控制】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址https://developer.aliyun.com/learning/course/363/detail/4332


R 的图形组合、图形布局的精细控制


内容简介:

一、图形组合

二、图形布局的精细控制

 

 

一、图形组合

(一)par()函数的 mfrow 参数

attach(mtCar s)

opar <- par (no.readonly=TRUE)2

par (mfrow=c(2,2))

>plot(wt,mpg,main="wt vs mpg")

> plot(wt,disp,main="wt vs disp")

hist(wt,main="Histogr am of wt''

boxplot(wt,main="Boxplot of wt"

> par(opar)

> detach(mtcars)

> attach(mtcars)

> opar <-par(no.readonly=TRUE)

> par(mfrow=c(3,1))

> hist(wt)

> hist(mpg)

>hist(disp)

> par(opar)

> detach(mtcars)

> attach(mtcars)

>layout(matrix(c(1,1,2,3)),2,2,byrow=TRUE)

Error in layout(matrix(c(1,1,2,3)),2,2,byrow=TRUE):

unused argument(byrow = TRUE)

>layout(matrix(c(1,1,2,3),2,2,byrow=TRUE))

>hist(wt)

> hist(mpg)

>hist(disp)

> par(opar)

> detach(mtcars)

 

(二) layout()函数

> attach(mtcars)

>layout(matrix(c(1,1,2,3)),2,2,byrow=TRUE),widths=c(3,1),

heights=c(1,2)

>hist(wt)

Error in plot. new(): figure margins too large

layout(matrix(c(1.1.2.3),2,2,byrowe=TRuE),widths=c(3.1),heights=c(1.1))

>hist(wt)

>hist(mpg)

>hist(disp)

> detach(mtcars)

 

二、图形布局的精细控制

par()函数的fig参数

attach(mtcars)

>layout(matrix(c(1,1,2,3),2,2,byrow=TRUE),widths=c(3,1),heights=c(1,2))

> hist(wit)

Error in plot.new0():figure margins too large

>layout(matrix(c(1,1,2,3,2,2,byrow=TRUE),widths=c(3,1),heights=c(1,1))

>hist(wt)

>hist(mpg)

>hist(disp)

> detach(mtcars)

> opar <- par (no. readonly=TRUE)

> par(fig=c(0, 0.8,0,0.8)) plot(mtcars$wt,mtcars$mpg,xlab="Gallon",ylab="weight")

>par(fig=c(0.65,1,0,0.8))

> boxplot (mtcarsSmpg,axes=FALSE)

>par (fig=c(0,0.8,0,0.8))

>plot(mtcars$wt,mtcars$mpg,xlab="Gallon",ylab="weight")

>par(fig=c(0.65,1,0,0.8),new=TRUE)

>boxplot(mtcarsSmpg,axes=FALSE)

>par(fig=c(0,0.8,0.55,1),new=TRUE)

>boxplot(mtcars$wt,horizontal=TRUE,axes=FALSE)

相关文章
|
测试技术 API 调度
NumPy 1.26 中文文档翻译完成(4)
NumPy 1.26 中文文档翻译完成
107 0
|
SQL 安全 网络安全
网络安全与信息安全:防御前线的关键技术与意识
【5月更文挑战第17天】在数字化时代,数据成为了新的货币,而网络安全则是保护这些资产不受威胁的保险箱。本文深入探讨了网络安全漏洞的概念、加密技术的重要性以及提升个人和企业的安全意识的必要性。通过分析当前网络环境中存在的风险,我们提出了一系列预防措施和应对策略,旨在帮助读者构建一个更加安全的数字生活和工作环境。
|
Go 调度
go基于信号的抢占式调度
go的调度器默认为抢占式调度。
306 0
|
存储 Ruby
|
前端开发
前端学习案例2-二进制中的操作符2
前端学习案例2-二进制中的操作符2
52 0
前端学习案例2-二进制中的操作符2
|
资源调度 分布式计算 Hadoop
Yarn管理动态队列
动态队列是在应用程序运行时自动创建的。当 YARN 服务重新启动时,它们将被删除。
1017 0
Yarn管理动态队列
|
容器
优化openGauss官方容器源码(二)
优化openGauss官方容器源码
332 0
|
存储 前端开发 NoSQL
技术汇总:第十六章:关于登录与退出的token
技术汇总:第十六章:关于登录与退出的token
393 0
|
Java 数据库 Spring
springboot(十三):springboot小技巧
一些springboot小技巧、小知识点 初始化数据 我们在做测试的时候经常需要初始化导入一些数据,如何来处理呢?会有两种选择,一种是使用Jpa,另外一种是Spring JDBC。两种方式各有区别下面来详细介绍。
14369 0