美文网首页
2019-06-03绘制带有误差线的折线图

2019-06-03绘制带有误差线的折线图

作者: 森尼啊 | 来源:发表于2019-06-03 22:49 被阅读0次

小伙伴说要画一个简单的带误差线的折线图,graphpad用不了,我琢磨一下,可以用R语言。本段代码是探究不同处理条件,伤口面积随着时间的变化,通过Rmisc包summarySE函数,得出图片如下:


Rplot.png
setwd("~/Desktop/190603")
getwd()
library("ggplot2")
install.packages("Rmisc")
library("Rmisc") 
woundarea <- read.csv("~/Desktop/190603/WoundArea3.csv",header = TRUE, stringsAsFactors = TRUE)
head(woundarea)
View(woundarea)
tgc <- summarySE(woundarea, measurevar="woundarea", groupvars=c("sample","days"))
tgc
#带有标准误差线的折线图
ggplot(tgc, aes(x=days, y=woundarea, colour=sample)) + 
  geom_errorbar(aes(ymin=woundarea-se, ymax=woundarea+se), width=.1) +
  geom_line() +
  geom_point()

相关文章

网友评论

      本文标题:2019-06-03绘制带有误差线的折线图

      本文链接:https://www.haomeiwen.com/subject/xmfkxctx.html