# Read values from tab-delimited files aaatariderraw_data <- read.table("AAATA-Fixed-Route-Ridership.tsv", header=T, sep="\t") # Define colors to be used plot_colors <- rainbow(12) date_day <- Sys.Date() file_name <- paste("AAATA-Ridership-go-pass", date_day,".png",sep="") png(filename=file_name, height=500, width=1500, bg="white") #bottom, left, top and right #par(mai=c(1.1,0.5,0.5,0.9)) par(mar=c(7,6,6,20)) go_pass_year_names <- c("go_pass_FY_2004","go_pass_FY_2005","go_pass_FY_2006","go_pass_FY_2007","go_pass_FY_2008","go_pass_FY_2009","go_pass_FY_2010","go_pass_FY_2011","go_pass_FY_2012","go_pass_FY_2013") total_year_names <- c("Total_Fixed_Route_FY_2004","Total_Fixed_Route_FY_2005","Total_Fixed_Route_FY_2006","Total_Fixed_Route_FY_2007","Total_Fixed_Route_FY_2008","Total_Fixed_Route_FY_2009","Total_Fixed_Route_FY_2010","Total_Fixed_Route_FY_2011","Total_Fixed_Route_FY_2012","Total_Fixed_Route_FY_2013") um_year_names <- c("UM_FY_2004","UM_FY_2005","UM_FY_2006","UM_FY_2007","UM_FY_2008","UM_FY_2009","UM_FY_2010","UM_FY_2011","UM_FY_2012","UM_FY_2013") for (i in 1:10){ year <- go_pass_year_names[i] plot(aaatariderraw_data[[year]], col=plot_colors[i], ylim=c(0,75000), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=1.5, pch=i) lines(aaatariderraw_data[[year]], pch=i, lty=1, lwd=1.75, col=plot_colors[i]) par(new=TRUE)} plot(aaatariderraw_data$go_pass_FY_2014, col="gray", ylim=c(0,75000), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=2, pch=11) lines(aaatariderraw_data$go_pass_FY_2014, pch=11, lty=1, lwd=6, col="gray") par(new=TRUE) plot(aaatariderraw_data$go_pass_FY_2015, col="black", ylim=c(0,75000), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=2, pch=12) lines(aaatariderraw_data$go_pass_FY_2015, pch=12, lty=1, lwd=6, col="black") graph_title <- paste("Monthly AAATA Fixed Route Ridership\n (Go!Pass Boardings)") #title(xlab= "", col.lab=rgb(0,0.5,0)) #title(ylab= "", col.lab=rgb(0,0.5,0)) axis(1, las=1, at=1:12, lab=c("Oct", "Nov", "Dec","Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept"), cex.axis=2, font=2) y <- seq(0,75000,10000) axis(2, at = y, labels = formatC(y, big.mark = ",", format = "d"), las = 1, font=2, cex.axis=1.5) title(main=graph_title, col.main="black", font.main=2, cex.main=2.5) legend_year_names <- c(go_pass_year_names,"go_pass_FY_2014","go_pass_FY_2015") legend_col <- c(plot_colors[1:10],"gray","black") legend("topleft", inset=c(1.01,0), legend_year_names, cex=1.2, col=legend_col, pch=1:12, lty=1, xpd=TRUE) mtext("Data from the AAATA", side = 1, line = 4, outer = FALSE, cex=0.9, font=2) box() dev.off() file_name <- paste("AAATA-Ridership-Total", date_day,".png",sep="") png(filename=file_name, height=500, width=1500, bg="white") #bottom, left, top and right #par(mai=c(1.1,0.5,0.5,0.9)) par(mar=c(7,6,6,20)) for (i in 1:10){ year <- total_year_names[i] plot(aaatariderraw_data[[year]], col=plot_colors[i], ylim=c(0,705000), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=1.5, pch=i) lines(aaatariderraw_data[[year]], pch=i, lty=1, lwd=1.75, col=plot_colors[i]) par(new=TRUE)} plot(aaatariderraw_data$Total_Fixed_Route_FY_2014, col="gray", ylim=c(0,750000), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=2, pch=11) lines(aaatariderraw_data$Total_Fixed_Route_FY_2014, pch=11, lty=1, lwd=6, col="gray") par(new=TRUE) plot(aaatariderraw_data$Total_Fixed_Route_FY_2015, col="black", ylim=c(0,750000), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=2, pch=12) lines(aaatariderraw_data$Total_Fixed_Route_FY_2015, pch=12, lty=1, lwd=6, col="black") graph_title <- paste("Monthly AAATA Fixed Route Ridership\n (Total Boardings)") #title(xlab= "", col.lab=rgb(0,0.5,0)) #title(ylab= "", col.lab=rgb(0,0.5,0)) axis(1, las=1, at=1:12, lab=c("Oct", "Nov", "Dec","Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept"), cex.axis=2, font=2) y <- seq(0,750000,100000) axis(2, at = y, labels = formatC(y, big.mark = ",", format = "d"), las = 1, font=2, cex.axis=1.5) title(main=graph_title, col.main="black", font.main=2, cex.main=2.5) legend_year_names <- c(total_year_names,"Total_Fixed_Route_FY_2014","Total_Fixed_Route_FY_2015") legend_col <- c(plot_colors[1:10],"gray","black") legend("topleft", inset=c(1.01,0), legend_year_names, cex=1.2, col=legend_col, pch=1:12, lty=1, xpd=TRUE) mtext("Data from the AAATA", side = 1, line = 4, outer = FALSE, cex=0.9, font=2) box() dev.off() file_name <- paste("AAATA-Ridership-UM", date_day,".png",sep="") png(filename=file_name, height=500, width=1500, bg="white") #bottom, left, top and right #par(mai=c(1.1,0.5,0.5,0.9)) par(mar=c(7,6,6,20)) for (i in 1:10){ year <- um_year_names[i] plot(aaatariderraw_data[[year]], col=plot_colors[i], ylim=c(0,400000), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=1.5, pch=i) lines(aaatariderraw_data[[year]], pch=i, lty=1, lwd=1.75, col=plot_colors[i]) par(new=TRUE)} plot(aaatariderraw_data$UM_FY_2014, col="gray", ylim=c(0,400000), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=2, pch=11) lines(aaatariderraw_data$UM_FY_2014, pch=11, lty=1, lwd=6, col="gray") par(new=TRUE) plot(aaatariderraw_data$UM_FY_2015, col="black", ylim=c(0,400000), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=2, pch=12) lines(aaatariderraw_data$UM_FY_2015, pch=12, lty=1, lwd=6, col="black") graph_title <- paste("Monthly AAATA Fixed Route Ridership\n (UM Boardings)") #title(xlab= "", col.lab=rgb(0,0.5,0)) #title(ylab= "", col.lab=rgb(0,0.5,0)) axis(1, las=1, at=1:12, lab=c("Oct", "Nov", "Dec","Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept"), cex.axis=2, font=2) y <- seq(0,400000,100000) axis(2, at = y, labels = formatC(y, big.mark = ",", format = "d"), las = 1, font=2, cex.axis=1.5) title(main=graph_title, col.main="black", font.main=2, cex.main=2.5) legend_year_names <- c(um_year_names,"UM_FY_2014","UM_FY_2015") legend_col <- c(plot_colors[1:10],"gray","black") legend("topleft", inset=c(1.01,0), legend_year_names, cex=1.2, col=legend_col, pch=1:12, lty=1, xpd=TRUE) mtext("Data from the AAATA", side = 1, line = 4, outer = FALSE, cex=0.9, font=2) box() dev.off()