title: Plot time series linear regression in ggplot2
body: <p>My question is about the representation of time series analysis from <code>tslm</code> with <code>ggplot2</code>. </p>
  
  <p>I have used <code>forecast</code> package to decompose SST time series in the Mediterranean in trend, seasonal and remainder components. Then I have looked for the slope (trend) of the linear regression for the trend component with <code>tslm</code>. But I can't figure out how to plot the <code>tslm</code> with ggplot2. Should I ggplot SST trend component with <code>geom_smooth(model=lm)</code>? Would <code>lm</code> provide the same results (slope) than <code>tslm</code>? </p>
  
  <p>This is the code used to build and decompose SST time series</p>
  
  <pre><code>library(forecast)
  
  # Loop to calculate trend for any grid point/column
  for (i in 2:length(data)){
  
    # read variable/column to analyse
    var&lt;-paste("V",i,sep="")
    ff&lt;-data$fecha
    valor&lt;-data[,i]  
    datos2&lt;-as.data.frame(cbind(data$fecha,valor))
  
    #Build time series
    datos.ts&lt;-ts(datos2$valor, frequency = 365)
    datos.stl &lt;- stl(datos.ts,s.window = 365)
  
    # tslm: Save trend component
    datos.tslm&lt;-tslm(datos.ts ~ trend)
    output[,i-1]&lt;-datos.stl$time.series[,2] 
  }
  
  # Summarize trends for the whole Mediterranean (mean value to be plotted)    
  trend&lt;-as.data.frame(rowMeans(output[,1:length(output)]))
  </code></pre>
  
  <p>And the code to plot with geom_smooth</p>
  
  <pre><code>trend.plot&lt;-ggplot(data=trend, aes(x=fecha, y=trend)) + geom_point(size=0.1) +
    geom_smooth(method='lm', data = trend[1:12784,]) 
  </code></pre>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>As SST data consists of a bunch of files, I've uploaded trend data to Dropbox and made available in this <a href="https://www.dropbox.com/s/93w8l500pquxfvc/trend_data.csv?dl=0" rel="nofollow noreferrer">csv file</a> </p>