# install neccessary packages and load libraries
install.packages (c("tidyverse"))
library ("tidyverse")
# load dataframe and split by date variable
WissDat <- read.csv("Data.csv")
WissDat$Date <- ifelse (WissDat$Date == "23-Sep" & WissDat$Measurement == 0, "23-Sep (A)",
ifelse(WissDat$Date == "23-Sep" & WissDat$Measurement == 1, "23-Sep (B)", WissDat$Date))
WissDat.split <- split(WissDat, WissDat$Date)
July29 <- WissDat.split$`29-Jul`
July30 <- WissDat.split$`30-Jul`
Aug5 <- WissDat.split$`5-Aug`
Aug6 <- WissDat.split$`6-Aug`
Aug8 <- WissDat.split$`8-Aug`
Sept23a <- WissDat.split$`23-Sep (A)`
Sept23b <- WissDat.split$`23-Sep (B)`
Oct7 <- WissDat.split$`7-Oct`
# create colorblind friendly palette for plotting
cbp1 <- c("#D55E00", "#E69F00", "#56B4E9", "#0072B2","#F0E442","#009E73","#999999", "#CC79A7")
# moisture by location plot for data collection on two days in July 2019
WissDat.Transect<- rbind(July29, July30)
options (repr.plot.width=14, repr.plot.height=10)
WissDat.Transect$DistJitter <- jitter(WissDat.Transect$Distance, amount = 5)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Moisture, color=Date, shape=Date)) +
geom_point(size=6, alpha=.8) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 2.2, .2), limits = c(1, 2.2)) +
scale_color_manual (values = cbp1) +
theme_minimal() +
ggtitle ("Soil Moisture by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# strength by location plot for data collection on two days in July 2019
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Strength, color=Date, shape=Date)) +
geom_point(size=6, alpha=.8) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 8.5, .5), limits = c(1, 8.5)) +
scale_color_manual (values = cbp1) +
theme_minimal() +
ggtitle ("Soil Strength by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# moisture by location plot that now includes data collection in September 2020
WissDat.Transect <- rbind(July29, July30, Sept23a, Sept23b)
WissDat.Transect$DistJitter <- ifelse(WissDat.Transect$Date == "29-Jul" | WissDat.Transect$Date == "30-Jul",
jitter(WissDat.Transect$Distance, amount = 5), WissDat.Transect$Distance)
WissDat.Transect$Date <- factor(WissDat.Transect$Date, levels = c("29-Jul", "30-Jul", "23-Sep (A)", "23-Sep (B)"))
alpha <- ifelse(WissDat.Transect$Date == "29-Jul" | WissDat.Transect$Date == "30-Jul", .25, .8)
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Moisture, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 2.2, .2), limits = c(1, 2.2)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18)) +
theme_minimal() +
ggtitle ("Soil Moisture by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# strength by location plot that now includes data collection in September 2020
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Strength, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 8.5, .5), limits = c(1, 8.5)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18)) +
theme_minimal() +
ggtitle ("Soil Strength by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# moisture by location plot that now includes data collection in October 2020
WissDat.Transect <- rbind(July29, July30, Sept23a, Sept23b, Oct7)
WissDat.Transect$DistJitter <- ifelse(WissDat.Transect$Date == "29-Jul" | WissDat.Transect$Date == "30-Jul" |
WissDat.Transect$Date == "7-Oct", jitter(WissDat.Transect$Distance,
amount = 5), WissDat.Transect$Distance)
WissDat.Transect$Date <- factor(WissDat.Transect$Date, levels = c("29-Jul", "30-Jul", "23-Sep (A)", "23-Sep (B)", "7-Oct"))
alpha <- ifelse(WissDat.Transect$Date == "7-Oct", .8, .25)
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Moisture, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 2.2, .2), limits = c(1, 2.2)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18,19)) +
theme_minimal() +
ggtitle ("Soil Moisture by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# strength by location plot that now includes data collection in September 2020
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Strength, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(0.5, 8.5, .5), limits = c(0.5, 8.5)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18,19)) +
theme_minimal() +
ggtitle ("Soil Strength by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )