I am trying to create a GGPLOT2 smoothed line graph that looks more like this
Source: http://www.esrl.noaa.gov/psd/enso/mei/
and less like this:
Source: https://dl.dropboxusercontent.com/u/16400709/StackOverflow/Rplot02.png
My data are available on dropbox.
Having looked at previous posts I used the code below:
#MEI Line Graph
d4 <- read.csv("https://dl.dropboxusercontent.com/u/16400709/StackOverflow/Data_MEI.csv")
head(d4,n=20)
MEI<-ggplot(d4,aes(x=d4$Date, y=d4$MEI,group=1))+geom_line()
MEI+stat_smooth(method ="auto",level=0.95)
What I think I need is to reduce the amount of smoothing taking place, but I have yet to figure out how to achieve this.
d4s<-SMA(d4$MEI,n=8)
plot.ts(d4s)
SMA() works well but I cant get it to work with ggplot Any hints would be appreciated!