我不是R的專家,但我多次使用ggplot2,從來沒有任何問題。不過,這一次我不能在我的圖表中畫出線條,我不知道爲什麼(它應該是非常簡單的東西)。ggplot2中我的geom_line()發生了什麼?
例如爲:
def.percent period
1 5.0657339 1984-1985
2 3.9164528 1985-1986
3 -1.756613 1986-1987
4 2.8184863 1987-1988
5 -2.606311 1988-1989
我不得不代碼:
ggplot(plot.tab, aes(x=period, y=def.percent)) + geom_line() + geom_point() + ggtitle("Deforestation rates within Properties")
但是當我運行它,它只是繪製的點,而一條線。它也給我這個消息:
geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?
它不是一個真正的錯誤,但我無法弄清楚如何繪製線......任何想法?
上之後,我添加了一個新列「posite」和「負」標籤「def.percent」,如:plot.tab $ valence < - NA /// plot.tab $ valence [plot.tab $ def.percent> = 0] < - 「pos」/// plot.tab $ valence [ plot.tab $ def.percent <0] < - 「neg」///然後我嘗試使用:geom_area(aes(fill = valence))+ ///來獲得彩色線條下的區域,但我一直得到這個錯誤:「美學不能隨着絲帶而變化」但是,當我嘗試使用其他數據集時,它的工作原理......這裏有什麼問題? – 2015-02-25 21:06:55