# Read values from tab-delimited files dda_total_system_data <- read.table("DDA-Total-System-Data.csv", header=T, sep="\t") # Define colors to be used plot_colors <- c("blue","red","orange","green","purple","black") date_day <- Sys.Date() file_name <- paste("DDA-Total-System-Revenue", 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.4,0.5,0.8)) par(mar=c(7,6,6,20)) #pdf(file=file_name, height=5, width=8, onefile=TRUE, family='Courier', paper='letter', pointsize=9) #par(mai=c(1.1,0.3,0.5,0.9)) #max_y <- max(scratch_y,na.rm=TRUE) max_y <- max(2000000,0) year_names <- c("REVENUE_2009_10","REVENUE_2010_11","REVENUE_2011_12","REVENUE_2012_13","REVENUE_2013_14","REVENUE_2014_15") for (i in 1:6){ year <- year_names[i] plot(dda_total_system_data[[year]], col=plot_colors[i], ylim=c(0,max_y), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=1.5, pch=i) lines(dda_total_system_data[[year]], pch=i, lty=1, lwd=2, col=plot_colors[i]) par(new=TRUE)} #graph_titlescratch <- deparse(substitute(stationname)) graph_title <- paste("Ann Arbor Public Parking System Data \n Total Revenue All Facilities") axis(1, las=1, at=1:12, lab=c("July", "Aug", "Sept", "Oct", "Nov", "Dec","Jan", "Feb", "Mar", "Apr", "May", "June"), cex.axis=2, font=2) #increment <- max(5*round((max_y/9)/5),1) #prettyNum(12345.678,big.mark=",",scientific=F) y <- seq(0, 2100000, 200000) axis(2, at = y, labels = sprintf("$%s M", formatC(y/1000000, digits=1, , format="f", big.mark = ".")), las = 1, font=2, cex.axis=1.5) #pts <- pretty(y / 1000000) #axis(2, at = pts, labels = paste(pts, "MM", sep = "")) #axis(4, at = y, labels = sprintf("$%s", y), formatC(y, big.mark = ",", format = "d"), las = 1, font=2, cex.axis=1.5) #axis(2, at = y, , las = 1, cex.axis=1, font=2, labels=sprintf("$%s", y)) title(xlab= "", col.lab=rgb(0,0.5,0)) title(ylab= "", col.lab=rgb(0,0.5,0), line=4) title(main=graph_title, col.main="black", font.main=2, cex.main=2.5) legend("topright", inset=c(-.21,0), year_names, cex=1.5, col=plot_colors[1:6], pch=1:6, lty=1, bg="white", xpd=TRUE) mtext("Data from the Ann Arbor Downtown Development Authority", side = 1, line = 4, outer = FALSE, cex=0.9, font=2) box() dev.off() file_name <- paste("DDA-Total-System-Patrons", 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.4,0.5,0.8)) par(mar=c(7,6,6,20)) #pdf(file=file_name, height=5, width=8, onefile=TRUE, family='Courier', paper='letter', pointsize=9) #par(mai=c(1.1,0.3,0.5,0.9)) #max_y <- max(scratch_y,na.rm=TRUE) max_y <- max(210000,0) year_names <- c("PATRONS_2009_10","PATRONS_2010_11","PATRONS_2011_12","PATRONS_2012_13","PATRONS_2013_14","PATRONS_2014_15") for (i in 1:6){ year <- year_names[i] plot(dda_total_system_data[[year]], col=plot_colors[i], ylim=c(0,max_y), xlim=c(1,12), axes=FALSE, ann=FALSE, lty=1, cex=1.5, pch=i) lines(dda_total_system_data[[year]], pch=i, lty=1, lwd=2, col=plot_colors[i]) par(new=TRUE)} graph_title <- paste("Ann Arbor Public Parking System Data \n Hourly Patrons All Facilities") axis(1, las=1, at=1:12, lab=c("July", "Aug", "Sept", "Oct", "Nov", "Dec","Jan", "Feb", "Mar", "Apr", "May", "June"), cex.axis=2, font=2) y <- seq(0, 200000, 10000) axis(2, at = y, las = 1, font=2, cex.axis=1.5) title(xlab= "", col.lab=rgb(0,0.5,0)) title(ylab= "", col.lab=rgb(0,0.5,0), line=4) title(main=graph_title, col.main="black", font.main=2, cex.main=2.5) legend("topright", inset=c(-.21,0), year_names, cex=1.5, col=plot_colors[1:6], pch=1:6, lty=1, bg="white", xpd=TRUE) mtext("Data from the Ann Arbor Downtown Development Authority", side = 1, line = 4, outer = FALSE, cex=0.9, font=2) box() dev.off()