Skip to content

Instantly share code, notes, and snippets.

@not-for-me
Created October 1, 2014 08:30
Show Gist options
  • Save not-for-me/00def939e3bea022f167 to your computer and use it in GitHub Desktop.
Save not-for-me/00def939e3bea022f167 to your computer and use it in GitHub Desktop.
CSV to Graph
pm10 <- data.frame(read.csv("~/Develop/Java/CSN-System/pm10.csv"))
id_2200501 <- sqldf("SELECT * FROM pm10 WHERE id = 2200501")
id_2030601 <- sqldf("SELECT * FROM pm10 WHERE id = 2030601")
id_2000901 <- sqldf("SELECT * FROM pm10 WHERE id = 2000901")
id_2001001 <- sqldf("SELECT * FROM pm10 WHERE id = 2001001")
plot(id_2200501$value, xaxt="n", ylim=c(0,300), xlab="Time", ylab="PM10(ug/m^3)", type="l", lty=1, lwd=2)
lines(id_2030601$value, col="firebrick", lty=1, lwd=2)
lines(id_2000901$value, col="dodgerblue4", lty=1, lwd=2)
lines(id_2001001$value, col="orange", lty=1, lwd=2)
axis(1,at=1:length(id_2200501$time),labels=id_2200501$time)
legend("top",legend=c("2200501", "2030601", "2000901", "2001001"),
lty=1,lwd=2, col=c("black","firebrick","dodgerblue4", "orange"), ncol=4,
bty="n",cex=0.8,
text.col=c("black","firebrick","dodgerblue4", "orange"),
inset=0.01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment