Reputation: 11
library(data.table)
library(ggplot2)
#1990~2017 RA result
year = c(1990:2017)
result = c(9140,9660,10600,11400,11500,12800,14000,15300,16900,18800,21400,28000,31600,35500,39800,44900,47800,50500,53300,55900,59700,58700,69300,71200,65600,53900,47000,33600)
RA_result <-data.table(year=year, result=result)
ggplot(RA_result)
Everytime when I make a plot with ggplot2 all output is all gray background nothing with any plot ONLY just gray color came out.
ggplot2 used to work well in my computer, but somehow it doesn't work as like I mentioned above.
I even did reinstall packages, or even R and R studio, still doesn't work. is there any problem with in R?
Upvotes: 1
Views: 1845
Reputation: 33782
The result is exactly as expected. You have passed a data table object to ggplot
without specifying which variables to plot, or what type of chart you want.
If you want, for example, a column chart:
ggplot(RA_result, aes(year, result)) + geom_col()
Upvotes: 3