blob: 166342f2bbbd7a65398eb98b95a1d904acf6df5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/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)
|