R code used to produce the graph shown below.

tikz(file="tikzexample.tex")                # Open tikz device 
plot(airquality$Temp, airquality$Ozone, 
     xlab="Temperature", ylab="Ozone")      # Make scatter plot 
model <- lm(Ozone ~ Temp, data=airquality)  # Estimate lin. reg. 
abline(model, lwd=3, lty=2)                 # Add line to plot 
# Add a lowess smoothed line to the plot as well 
# lowess requires complete cases only 
cc <- complete.cases(airquality$Temp, airquality$Ozone) 
lines(lowess(airquality$Temp[cc], airquality$Ozone[cc]), 
      lwd=3, lty=1) 
# Add a legend 
legend(60, 150, c("Lowess", "Lin. reg."), lty=1:2, lwd=3)