我想要一个线图,其中value
的绘制是每层中expt
有一条线的函数var
:
这是我的数据:
lines <- "
expt,var,value
1,none.p,0.183065327746799
2,none.p,0.254234138384241
3,none.p,0.376477571234912
1,male.p,-1.58289835719949
2,male.p,-1.98591548366901
3,male.p,-2.02814824729229
1,neutral.p,-2.01490302054226
2,neutral.p,-1.88178562088577
3,neutral.p,-1.68089687641625
1,female.p,-3.27294304613848
2,female.p,-3.07711187982237
3,female.p,-2.89652562347054
1,both.p,-2.40011011312792
2,both.p,-2.24495598015741
3,both.p,-2.78501124223834"
con <- textConnection(lines)
data <- read.csv(con)
close(con)
expt
是一个因素:
data$expt <- factor(data$expt)
使用时一切正常 geom_point
ggplot(data, aes(expt, value, colour=var)) + geom_point()
但是当我使用 geom_line
ggplot(data, aes(expt, value, colour=var)) + geom_line()
我收到以下错误消息
geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
和一个空的情节。当expt
为数字时,它可以工作,但是我更喜欢使用一个因数,因为它在x轴上为我提供了正确的标签。这是什么问题 我发现这适用于点而不适用于线是非常违反直觉的。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句