Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 ggplot2 创建一个包含因子和几个因变量的折线图。数据框的结构如下:
组时间 DVName 平均值 SE
我想生成一个折线图,其中 x=Time,y=Mean,color=DVName,linetype=Group。然而,当我尝试填写这些时,我得到了一些奇怪的结果,其中一些数据点是垂直连接的,而不是水平连接的。我还注意到,我输入数据集的顺序会对图表的外观产生影响(按组排序产生的图表与按时间排序不同)。
有什么帮助吗?
干杯! D
类似的东西?模拟数据相当丑陋...
df <- data.frame(Group=factor(rep(1:3,20)),Time=runif(60),DVName=sample(c("a","b","c"), 60, rep=TRUE),Mean=rnorm(60)) ggplot(data=df) + geom_line(aes(x=Time, y=Mean, colour=DVName, linetype=Group))