-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfisherPlots.R
More file actions
85 lines (75 loc) · 3.34 KB
/
fisherPlots.R
File metadata and controls
85 lines (75 loc) · 3.34 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
library(dplyr)
library(readr)
library(tidyr)
library(forcats)
library(lubridate)
library(ggplot2)
library(latex2exp)
# READ IN AND SORT
x <- read_csv("/Users/davidkahler/Documents/R/Lab-Data-Collection/FisherHall.csv", col_names = FALSE)
x <- x %>%
select(-X1, -X4, -X7, -X8, -X9, -X10) %>%
rename(unix_utc = X2,
time_et = X3,
Variable = X5,
Value = X6)
this <- isoweek(Sys.Date())
lastweek <- x %>%
mutate(w = isoweek(time_et)) %>%
filter(w == (this-1)) %>%
mutate(d = as_date(time_et)) %>%
select(time_et,d,Variable,Value)
air_temp <- filter(lastweek, Variable == "AirTC_Avg")
air_temp <- ggplot(air_temp) +
geom_line(aes(x=time_et,y=Value)) +
scale_x_datetime() +
xlab("Date") +
ylab(TeX('Air Temperature $(^o C)$')) +
#ylab("Air Temperature (Celcius)") +
theme(panel.background = element_rect(fill = "white", colour = "black")) +
theme(aspect.ratio = 0.3) +
theme(axis.text = element_text(face = "plain", size = 12), axis.title = element_text(face = "plain", size = 14))
ggsave("FISHERtemp.jpg", plot = air_temp, device = "jpeg", dpi = 72, width = 20, height = 10, units = "cm")
rh <- filter(lastweek, Variable == "RH")
rh <- ggplot(rh) +
geom_line(aes(x=time_et,y=Value)) +
scale_x_datetime() +
xlab("Date") +
ylab("Relative Humidity (%)") +
theme(panel.background = element_rect(fill = "white", colour = "black")) +
theme(aspect.ratio = 0.3) +
theme(axis.text = element_text(face = "plain", size = 12), axis.title = element_text(face = "plain", size = 14))
ggsave("FISHERrh.jpg", plot = rh, device = "jpeg", dpi = 72, width = 20, height = 10, units = "cm")
bp <- filter(lastweek, Variable == "BV_BP_Avg")
bp <- ggplot(bp) +
geom_line(aes(x=time_et,y=Value)) +
scale_x_datetime() +
xlab("Date") +
ylab("Barometric Pressure (hPa)") +
theme(panel.background = element_rect(fill = "white", colour = "black")) +
theme(aspect.ratio = 0.3) +
theme(axis.text = element_text(face = "plain", size = 12), axis.title = element_text(face = "plain", size = 14))
ggsave("FISHERpres.jpg", plot = bp, device = "jpeg", dpi = 72, width = 20, height = 10, units = "cm")
srad <- filter(lastweek, Variable == "SlrW_Avg")
srad <- ggplot(srad) +
geom_line(aes(x=time_et,y=Value)) +
scale_x_datetime() +
xlab("Date") +
ylab(TeX('Solar Radiation $(W/m^2)$')) +
theme(panel.background = element_rect(fill = "white", colour = "black")) +
theme(aspect.ratio = 0.3) +
theme(axis.text = element_text(face = "plain", size = 12), axis.title = element_text(face = "plain", size = 14))
ggsave("FISHERrad.jpg", plot = srad, device = "jpeg", dpi = 72, width = 20, height = 10, units = "cm")
precip <- lastweek %>%
filter(Variable == "Rain_mm_Tot") %>%
group_by(d) %>%
summarize(Value = sum(Value), dt = mean(time_et))
precip <- ggplot(precip) +
geom_col(aes(x=dt,y=Value)) +
scale_x_datetime() +
xlab("Date") +
ylab("Daily Precipitation (mm)") +
theme(panel.background = element_rect(fill = "white", colour = "black")) +
theme(aspect.ratio = 0.3) +
theme(axis.text = element_text(face = "plain", size = 12), axis.title = element_text(face = "plain", size = 14))
ggsave("FISHERprecip.jpg", plot = precip, device = "jpeg", dpi = 72, width = 20, height = 10, units = "cm")