当前位置:首页 > R语言初学者指南学习摘要
载入数据
> BFDeaths <- read.table (file = “BFDeaths.txt”, header = TRUE ) > Deaths <- rowSums (BFDeaths[ , 2:16] ) > names (Deaths) <- BFDeaths[ , 1] > Deaths
条形图生成命令
> par (mfrow = c(2,2), mar = c(3,3,2,1) )
> barplot (Cases , main = “Bird flu cases”) #A类标准条形图 > Counts <- cbind (Cases, Deaths)
> barplot (Counts ) #B类堆积条形图
> barplot (t(Counts), col = gray(c(0.5, 1)) ) #C类累积条形图 > barplot (t(Counts), beside = TRUE ) #D类邻接条形图 7.5 重新访问plot函数
> plot (y = Benthic$Richness, x = Benthic$NAP, xlab = “Mean high tide (m)”,
ylab = “Species richness”, main = “Benthic data”) > M0 <- 1m (Richness ~ NAP, data = Benthic) 1m利用线性回归建立物种丰富度作为平均涨潮水平的函数模型
> abline(M0) #添加拟合线
参数
做什么
main 在图形上添加一个标题
xlab, ylab 在X轴和Y轴增加标签 xlim, ylim 设置轴的上下线 log type
Log=”x”, Log=”y”, log=”xy” 生成对数轴 Type = “p”,”l”,”b”,”o”用于绘图点,线,由线连接的点,线连接并覆盖点,从点到坐标轴的垂直线,阶梯线,只有坐标轴
共分享92篇相关文档