服务热线
178 0020 3020
数据如附件的xlsx文件,注意里面有三个表。
编写R语言的代码如下:
#绘制单折线图 library("xlsx") data <- read.xlsx("E:/R2.xlsx",sheetIndex = 1) x <- data$C y <- data$N png(file="E:/R2-1.png") plot( x, y, type="o", xlab="Leu浓度", ylab="增值数目", main="不同浓度亮氨酸处理对细胞增值的影响" ) dev.off() #绘制双折线图 data2 <- read.xlsx("E:/R2.xlsx",sheetIndex = 2) x <- data2$s y <- data2$u y2 <- data2$d png(file="E:/R2-2.png") plot( x, y, type="o", ylim=c(0,1000), xlab="序号", ylab="消费额", main="上下半年消费", col="red" ) lines( y2, type = "o", col = "green" ) dev.off() #绘制频次 data3 <- read.xlsx("E:/R2.xlsx",sheetIndex = 3) x <- data3$Fe3O4 png(file="E:/R2-3.png") hist( x, freq = F, xlab = "w", ylab = "Density", main = "Histogram of w" ) lines(density(x),col = "green") dev.off()
运行以上代码,在E盘下面得到如下三张图片
附件