无法在同一个图中绘制多条线图

问题描述:

我有以下代码,我想绘制两条线,两条线均在同一数据框中指定。但是,我得到了很大的彩色阴影,我无法弄清楚原因。这些数据和代码看起来是正确的,我...无法在同一个图中绘制多条线图

library('ggplot2') 
library('reshape2') 

df <- read.csv(url("http://smallchess.com/test.csv"), row.names=1) 
melted = melt(df, id.vars='time') 
p <- ggplot(data=melted, aes(x=time, y=value, group=variable, colour=variable)) + geom_line() 
print(p) 

enter image description here

+0

。该图表示,你必须在每一个独特的x值的多个y值。我怀疑有一种方法可以在'aes()'函数中总结或声明'group = ...'变量。 – Matt74

两个变量表现出无比的振荡值。以便每条线与其邻居重叠。这样就产生了这个不透明的结构。或许它帮助,如果你设置你的行size到这样的低值:

p <- ggplot(data=melted, aes(x=time, y=value, group=variable, colour=variable)) + 
    geom_line(size = 0.05) 
print(p) 

enter image description here