# Statistics NZ Tatauranga Aotearoa https://www.stats.govt.nz/indicators/greenhouse-gas-concentrations
# go to 'Download' click through and 'Download all data' and right click copy link
download.file("https://statisticsnz.shinyapps.io/ghg_concentrations_oct20/_w_d5223dbc/session/b3dde967ab0df32633f7977e7728c693/download/download?w=d5223dbc","download?w=d5223dbc")
# unzip downloaded zip file
unzip("download?w=d5223dbc")
# read in the data file
state_data <- read.csv("state_data.csv")
# select only methane records
methane <- state_data[state_data[["gas"]]=="Methane",]
svg(filename="NZmethane-2019-720by540.svg", width = 8, height = 6, pointsize = 14, onefile = FALSE, family = "sans", bg = "white", antialias = c("default", "none", "gray", "subpixel"))
par(mar=c(2.7,3.3,1,1)+0.1)
plot(methane[["period_end"]],methane[["concentration"]],tck=0.01,ylab=NA,axes=T,ann=T, type="l",lwd=2,las=1,col="#7570B3")
box(lwd=1)
mtext(side=1,line=-1.4,cex=1,"Data: Stats NZ Tatauranga Aotearoa \nhttps://www.stats.govt.nz/indicators/greenhouse-gas-concentrations")
mtext(side=3,cex=1.3, line=-1.8,expression(paste("Baring Head Methane concentrations 1989 to 2019")) )
mtext(side=2,cex=1.1, line=-1.5,expression(paste("Parts per billion")))
mtext(side=4,cex=0.75, line=0.05,R.version.string)
dev.off()