简体   繁体   中英

ggplot2 only plotting axes - not the points

I have a CSV file like:

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

but then read into R and plotted

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

The output is empty. Ie axes are present but no points are plotted. A regular plot(foo2$foo) simply plots the points - what could be wrong here?

You need to add a geom to your plot. If you want a line plot add...

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

If you want a scatter plot...

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

You can find more geoms here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM