1
所以我的題爲Site.377
在x軸我想這是在X
柱,然後將其它4列都有權Results1
,Results2
的時間的大的數據集的線圖,和Results3
。我想把它們全部放在同一個圖表上,以比較Results1到3隨着時間的推移如何相互比較。繪製與R中的多個列
我目前所做的是:
library(ggplot2)
p <- ggplot(Site.377, aes(x=X, y = Results1) #This was just an attempt to get one of them to post
p + geom_line()
當我會做到這一點,得到的情節也只是都smushed一起堆放在一旁的數值。好像一列數字重疊。
任何幫助將不勝感激。
X Results1 Results2
1 0 .23
2 .83 0
3 .56 .62
4 0 .11
你能張貼dput的'輸出(頭提供數據的樣本(網站後.377))'。 '繪製reshape2 :: melt'並將'colour'添加到'aes'可能是您想要做的類似於http://stackoverflow.com/questions/21616688/ggplot-not-adding-legend-what-am- i-missing-very-to-r/21616934#21616934 –
該集合中的數據量太大而無法在dput(head(Site.377))中發佈結果。我剛剛嘗試過:ggplot(Site.377,aes(x = X,y = Results1))+ geom_line(color =「black」) 並且具有相同的結果。我可能誤解了你所說的話。 – user3363054
你能提供數據的前幾列嗎?像'dput(head(Site.377 [1:10]))''。或者創建具有相同特徵併產生相同問題的數據。我猜這樣的東西會工作'dfm < - melt(Site.377,id.vars =「X」); ggplot(dfm,aes(x = X,y = value,color = variable))+ geom_line()' –