We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# 2.3.1 用par函数布局页面 # 其中参数mfrow和mfcol分别以行和列进行分割并顺序填充 # par(mfrow=c(2,2), mai=c(0.5,0.5,0.3,0.1), cex=0.7,mgp=c(2,1,0),cex.axis=0.8,cex.main=0.8) par(mfcol=c(2,2), mai=c(0.5,0.5,0.3,0.1), cex=0.7,mgp=c(2,1,0),cex.axis=0.8,cex.main=0.8) par(family= "Songti SC") # 设置随机数种子 set.seed(123) # 生成100个标准正态分布随机数 x <-rnorm(100) # 生成100个指数分布随机数 y <-rexp(100) plot(x,y,col=sample(c("black","red","blue"), 100, replace = TRUE), main = "(a) 散点图") boxplot(x,y,col = 2:3, main="(b) 箱线图") hist(x, col = "orange", ylab ="y", main="(c) 箱线图") barplot(runif(5,10,20), col = 2:6, main = "(d) 条形图") # 2.3.2 用layout函数布局页面 # 2行2列的图表矩形,第2行为单张图 layout(matrix(c(1,2,3,3), nrow = 2, ncol = 2, byrow = TRUE), heights= c(2,1)) # 3部分全展示 layout.show(3) # 2行2列的图表矩形,第2列为单张图 layout(matrix(c(1,2,3,3), nrow = 2, ncol = 2), heights= c(2,1)) # 3部分全展示 layout.show(3) # 2行3列的图表矩形,第2行为单张图 layout(matrix(c(1, 1, 1, 2, 3, 4), nrow = 2, ncol = 3, byrow = TRUE), widths= c(3, 1), heights= c(2,1)) # 3部分全展示 layout.show(4) # 3行3列的图表矩形,第2行为两张图 layout(matrix(c(1, 2, 3, 4, 5,6, 7,8), nrow = 3, ncol = 3, byrow = TRUE), widths= c(2, 1), heights= c(1,1)) # 3部分全展示 layout.show(8) # 2.3.3 同时打开多个绘图窗口 par(family= "Songti SC") # 生成1000个标准正态分布的随机数 x <- rnorm(1000) # 绘制直方图 hist(x, col=3, xlab= "", ylab="", main="直方图") # 打开一个新的绘图窗口 dev.new() # 绘制核密度图 plot(density(x), xlab = "", ylab = "", main="核密度图")
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: