2017-09-15 147 views
-1

我有一個CSV文件,如:GGPLOT2只繪製軸線 - 而不是點

date;foo 
2016-07-01;0,54 
2016-08-01;0,54 
2016-09-01;0,50 
2016-10-01;0,49 

但後來讀入R和繪製

foo2 <- read.csv2("here") 
ggplot(foo2, aes(x=date, y=foo)) 

輸出是空的。即軸存在但沒有繪製點。 常規plot(foo2$foo)只是繪製點 - 這裏可能是錯誤的?

+0

在地圖上添加'geom' – bouncyball

+0

'ggplot(foo2,aes(x = date,y = foo))+ geom_ {FOO}'其中'FOO == [point,line,bar,hist,.. 。]' – PoGibas

+0

add + geom_point() – User632716

回答

4

你需要添加一個geom到你的情節。如果你想有一個線圖添加...

ggplot(foo2, aes(x=date, y=foo)) + geom_line() 

如果你想有一個散點圖...

ggplot(foo2, aes(x=date, y=foo)) + geom_point() 

你可以找到更多geoms here