# load the data
data(monthly)
# make a plot
cols <- c("NOx" = "#28B2E0","VOC" = "#66E024","PM" = "#960606")
plot(NA, xlim = c(1,12), ylim = c(-75,130),
xaxt = "n", xlab = "Month",main = "Profile for total emissions",
ylab = "Monthly adjustment [%]",cex.lab = 1.4, cex.axis = 1.2)
axis(1, at = 1:12, labels = month.abb, cex.axis = 1.2)
for (v in c("NOx", "VOC", "PM")) {
y <- monthly[[v]] * 100 - 100 # convert to % change
points(monthly$month, y, col = cols[v], pch = 16)
lo <- loess(y ~ month, data = monthly, span = 0.4)
xs <- seq(1,12, length.out = 200)
lines(xs, predict(lo, newdata = data.frame(month = xs)),
col = cols[v], lwd = 2)
}
legend("topleft", legend = c(expression(NO[x]), "VOCs", expression(PM[2.5])),
col = cols, pch = 16, lwd = 2, pt.cex = 1.5, bty = "n",cex = 1.2)
Run the code above in your browser using DataLab