#!/usr/bin/Rscript --vanilla require(RPostgreSQL) drv <- dbDriver("PostgreSQL") con <- dbConnect(drv, host="10.2.2.22", user="jack", password="jack", dbname="ebus") # plot 1 png(file = "Rplots.png") data <- dbGetQuery(con, "select DISTINCT timestamp,value_float from value where sensor_id = 47") print(data) data$timestamp <- as.POSIXlt(as.character(data$timestamp)) plot(data$timestamp, data$value_float,type="l",axes=FALSE) r <- as.POSIXct(range(data$timestamp)) axis.POSIXct(1, at=seq(r[1], r[2], by="hour"), format="%H") title("Temperaturplot") box() print(data) dev.off() #dbDisconnect(con)