Skip to content

Instantly share code, notes, and snippets.

@andybell
Last active September 26, 2016 15:06
Show Gist options
  • Save andybell/f7fe7b8a15503839676b27dcec86b4d3 to your computer and use it in GitHub Desktop.
Save andybell/f7fe7b8a15503839676b27dcec86b4d3 to your computer and use it in GitHub Desktop.
Creates bare ET vs measured graphs at five stations
# graph comparing methods with bare ET
library(ggplot2)
# load data
data <- read.csv('BareET_sept2015.csv')
# pop off measured data
measured <- tail(data, 1)
data <- head(data, -1)
# plot for each station using each method as a point and the measured values as a horiz dashed red line
# TODO - figure out how to make loop using calling vars as column names
# station 1
p1 <- ggplot(data, aes(x=Method, y=D1))+
geom_point(cex=4, colour="dark blue")+
xlab('')+ylab('ET (mm per day)')+
theme_bw()+
ggtitle('D1')+
geom_hline(aes(yintercept=measured$D1), lty=2, colour="red3")+
geom_text(aes(4,measured$D1,label = "SR Station", vjust = 1), size=4, colour="red3")
p1
png(filename = 'D1.png', 500, 300)
plot(p1)
dev.off()
# station 2
p2 <- ggplot(data, aes(x=Method, y=D2))+
geom_point(cex=4, colour="dark blue")+
xlab('')+ylab('ET (mm per day)')+
theme_bw()+
ggtitle('D2')+
geom_hline(aes(yintercept=measured$D2), lty=2, colour="red3")+
geom_text(aes(4,measured$D2,label = "SR Station", vjust = 1), size=4, colour="red3")
p2
png(filename = 'D2.png', 500, 300)
plot(p2)
dev.off()
# station 3
p3 <- ggplot(data, aes(x=Method, y=D3))+
geom_point(cex=4, colour="dark blue")+
xlab('')+ylab('ET (mm per day)')+
theme_bw()+
ggtitle('D3')+
geom_hline(aes(yintercept=measured$D3), lty=2, colour="red3")+
geom_text(aes(4,measured$D3,label = "SR Station", vjust = 1), size=4, colour="red3")
p3
png(filename = 'D3.png', 500, 300)
plot(p3)
dev.off()
# station 4
p4 <- ggplot(data, aes(x=Method, y=D4))+
geom_point(cex=4, colour="dark blue")+
xlab('')+ylab('ET (mm per day)')+
theme_bw()+
ggtitle('D4')+
geom_hline(aes(yintercept=measured$D4), lty=2, colour="red3")+
geom_text(aes(4,measured$D4,label = "SR Station", vjust = 1), size=4, colour="red3")
p4
png(filename = 'D4.png', 500, 300)
plot(p4)
dev.off()
#station 5
p5 <- ggplot(data, aes(x=Method, y=D5))+
geom_point(cex=4, colour="dark blue")+
xlab('')+ylab('ET (mm per day)')+
theme_bw()+
ggtitle('D5')+
geom_hline(aes(yintercept=measured$D5), lty=2, colour="red3")+ # horiz line for measured value from SR station
geom_hline(aes(yintercept=0.144067827), lty=4, colour="red3")+ # horiz line for EC Station
geom_text(aes(4,measured$D5,label = "SR Station", vjust = 1), size=4, colour="red3") +
geom_text(aes(4, 0.144067827,label = "EC Station", vjust = 1), size=4, colour="red3")
p5
png(filename = 'D5.png', 500, 300)
plot(p5)
dev.off()
Method D1 D2 D3 D4 D5
CalSIMETAW 0.4 0.4 0.4
DETAW 0.4 0.4 2.7
DisALEXI 2 1.8 1.6 1.7 1.3
ITRC 1.3 1.5 0.8 0.9 0.7
SIMS 1.3 1.3 1.6
UCD-METRIC 1.5 2.4 1.6 2.5 1.8
UCD-PT 3.3 3.3 4.4
MEASURED 0.17 0.35 0.051 0.41 0.39
@andybell
Copy link
Author

d1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment