exec/Figure3_Root_by_depth_wholeprofile_revision.R

library(ggplot2)
library(gridExtra)
library(cowplot)
library(scales)
setwd("D:/R_Workspace/SDEF/SDEF.analysis/data")
load("Alldates_depthbin_rootbiomass.Rdata")
load("RootBiomass_totals.Rdata")
alldates$se_length <- ((alldates$sd_length)/sqrt(alldates$n_length))
alldates$se_diameter <- ((alldates$sd_diameter)/sqrt(alldates$n_diameter))
alldates$surfacearea <- ((pi*((alldates$mean_diameter)^2)*alldates$mean_length))
### add in native v invasive
ad <- subset(alldates, alldates$site == "adenostoma")
ad$veg_type <- rep("Native", times = 19)
g <- subset(alldates, alldates$site == "grass")
g$veg_type <- rep("Invasive", times = 20)
alldates <- rbind(ad, g)
rm(ad, g)
###
ad <- subset(Totals, Totals$veg_type == "Adenostoma")
ad$veg_type <- rep("Native", times = 5)
g <- subset(Totals, Totals$veg_type == "Grass")
g$veg_type <- rep("Invasive", times = 5)
Totals <- rbind(ad, g)
rm(ad, g)

### Subset by depth
zt10 <- subset(alldates, alldates$depth_bin == 1)
tent20 <- subset(alldates, alldates$depth_bin == 2)
twent30 <- subset(alldates, alldates$depth_bin == 3)
thirt40 <- subset(alldates, alldates$depth_bin == 4)


### add in zero value for Adenostoma in december
zt10[10, ] <- rbind(zt10[1, ])
zt10[10, 2] <- "Dec"
zt10[10, c(4:20,22:24)] <- 0
zt10[10, 21] <- as.Date("12/01/2015", format = "%m/%d/%Y")

##########BW FIGURE########
# make graph each panel is a separate dept, x axis date, y axis time
#0-10
ad10 <- subset(zt10, zt10$site == "adenostoma")
g10 <- subset(zt10, zt10$site == "grass")

p1 <- ggplot(data = ad10, aes(y = mean_biodensity_dm, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad10, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad10, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  ylab(expression(paste("Root biomass per soil volume (g   ", dm^-3, ")"))) +
  xlab("") +
  ggtitle("0-10 cm") +
  scale_y_continuous(limits = c(0, .75), breaks = c(0, 0.1, 0.2, 0.3, 0.4, 0.5,  0.6,0.7)) +
  geom_point(data = g10,position = position_nudge(x = 10),shape = 17,  aes(colour = "Invasive", size = 1), show.legend = F)+
  geom_errorbar(data = g10, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("grey50", "black"), guide = F) +
  theme_bw()+
  theme(plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p1

# 10 -20
ad20 <- subset(tent20, tent20$site == "adenostoma")
g20 <- subset(tent20, tent20$site == "grass")

p2 <- ggplot(data = ad20, aes(y = mean_biodensity_dm, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad20, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad20, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("10-20 cm") +
  scale_y_continuous(limits = c(0, .75))+
  geom_point(data = g20,position = position_nudge(x = 10), shape = 17,  aes(colour = "Invasive", size = 1), show.legend = F)+
  geom_errorbar(data = g20, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("grey50", "black"), guide = F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p2

### 20-30
ad30 <- subset(twent30, twent30$site == "adenostoma")
g30 <- subset(twent30, twent30$site == "grass")

p3 <- ggplot(data = ad30, aes(y = mean_biodensity_dm, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad30, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad30, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("20-30 cm") +
  scale_y_continuous(limits = c(0, .75))+
  geom_point(data = g30,position = position_nudge(x = 10), shape = 17,  aes(colour = "Invasive", size = 1), show.legend = F)+
  geom_errorbar(data = g30, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("grey50", "black"), guide = F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p3

# 30-40
ad40 <- subset(thirt40, thirt40$site == "adenostoma")
g40 <- subset(thirt40, thirt40$site == "grass")

p4 <- ggplot(data = ad40, aes(y = mean_biodensity_dm, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad40, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad40, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("30-40 cm") +
  scale_y_continuous(limits = c(0, .75))+
  geom_point(data = g40,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1), shape = 17, show.legend = F)+
  geom_errorbar(data = g40, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("black", "grey50"), guide = F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p4

## Total

adtot <- subset(Totals, Totals$veg_type == "Native")
gtot <- subset(Totals, Totals$veg_type == "Invasive")

p5 <- ggplot(data = adtot, aes(y = biomass, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = adtot, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = adtot, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("0-40 cm") +
  scale_y_continuous(limits = c(0, .75))+
  geom_point(data = gtot,position = position_nudge(x = 10), shape = 17,   aes(colour = "Invasive", size = 1), show.legend = F)+
  geom_errorbar(data = gtot, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("black", "grey50"), guide =F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p5

grid.arrange(p1, p2, p3, p4, p5, ncol=5)

#######COLOR###########
##########Make the same figure in COLOR
ad10 <- subset(zt10, zt10$site == "adenostoma")
g10 <- subset(zt10, zt10$site == "grass")

p1 <- ggplot(data = ad10, aes(y = mean_biodensity_dm, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad10, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad10, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  ylab(expression(paste("Root biomass per soil volume (g   ", dm^-3, ")"))) +
  xlab("") +
  ggtitle("0-10 cm") +
  scale_y_continuous(limits = c(0, .75), breaks = c(0, 0.1, 0.2, 0.3, 0.4, 0.5,  0.6,0.7)) +
  geom_point(data = g10,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1), shape = 17, show.legend = F)+
  geom_errorbar(data = g10, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide = F) +
  theme_bw()+
  theme(plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p1

# 10 -20
ad20 <- subset(tent20, tent20$site == "adenostoma")
g20 <- subset(tent20, tent20$site == "grass")

p2 <- ggplot(data = ad20, aes(y = mean_biodensity_dm, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad20, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad20, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("10-20 cm") +
  scale_y_continuous(limits = c(0, .75))+
  geom_point(data = g20,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1), shape = 17, show.legend = F)+
  geom_errorbar(data = g20, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide = F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p2

### 20-30
ad30 <- subset(twent30, twent30$site == "adenostoma")
g30 <- subset(twent30, twent30$site == "grass")

p3 <- ggplot(data = ad30, aes(y = mean_biodensity_dm, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad30, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad30, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("20-30 cm") +
  scale_y_continuous(limits = c(0, .75))+
  geom_point(data = g30,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1),shape = 17, show.legend = F)+
  geom_errorbar(data = g30, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide = F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p3

# 30-40
ad40 <- subset(thirt40, thirt40$site == "adenostoma")
g40 <- subset(thirt40, thirt40$site == "grass")

p4 <- ggplot(data = ad40, aes(y = mean_biodensity_dm, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad40, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad40, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("30-40 cm") +
  scale_y_continuous(limits = c(0, .75))+
  geom_point(data = g40,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1),shape = 17, show.legend = F)+
  geom_errorbar(data = g40, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide = F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p4

## Total

adtot <- subset(Totals, Totals$veg_type == "Native")
gtot <- subset(Totals, Totals$veg_type == "Invasive")

p5 <- ggplot(data = adtot, aes(y = biomass, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = adtot, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = adtot, aes(x = Date, ymin=minse, ymax=maxse, width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("Total") +
  scale_y_continuous(limits = c(0, .75))+
  geom_point(data = gtot,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1),shape = 17, show.legend = F)+
  geom_errorbar(data = gtot, position = position_nudge(x = 10), aes(x = Date, ymin=minse, ymax=maxse, width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide =F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p5

grid.arrange(p1, p2, p3, p4, p5, ncol=5)


#########LENGTH###########

ad10 <- subset(zt10, zt10$site == "adenostoma")
g10 <- subset(zt10, zt10$site == "grass")

p1 <- ggplot(data = ad10, aes(y = mean_length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad10, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad10, aes(x = Date, ymin=(mean_length - sd_length), ymax=(mean_length +sd_length), width = 10,  colour = "Native") ) +
  ylab("") +
  xlab("") +
  ggtitle("0-10 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = g10,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1),shape = 17, show.legend = F)+
  geom_errorbar(data = g10, position = position_nudge(x = 10), aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide = F) +
  theme_bw()+
  theme(plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p1

# 10 -20
ad20 <- subset(tent20, tent20$site == "adenostoma")
g20 <- subset(tent20, tent20$site == "grass")

p2 <- ggplot(data = ad20, aes(y = mean_length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad20, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad20, aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 10,  colour = "Native") ) +
  ylab("") +
  xlab("") +
  ggtitle("10-20 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = g20,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1), shape = 17, show.legend = F)+
  geom_errorbar(data = g20, position = position_nudge(x = 10), aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide = F) +
  theme_bw()+
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p2

### 20-30
ad30 <- subset(twent30, twent30$site == "adenostoma")
g30 <- subset(twent30, twent30$site == "grass")

p3 <- ggplot(data = ad30, aes(y = mean_length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad30, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad30, aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 10,  colour = "Native") ) +
  ylab("") +
  xlab("") +
  ggtitle("20-30 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = g30,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1), shape = 17, show.legend = F)+
  geom_errorbar(data = g30, position = position_nudge(x = 10), aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide = F) +
  theme_bw()+
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p3

# 30-40
ad40 <- subset(thirt40, thirt40$site == "adenostoma")
g40 <- subset(thirt40, thirt40$site == "grass")

p4 <- ggplot(data = ad40, aes(y = mean_length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad40, aes(colour = "Native", size = 1),  show.legend = F)+
  geom_errorbar(data = ad40, aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 10,  colour = "Native") ) +
  ylab("") +
  xlab("") +
  ggtitle("30-40 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = g40,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1),shape = 17, show.legend = F)+
  geom_errorbar(data = g40, position = position_nudge(x = 10), aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide = F) +
  theme_bw()+
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p4

adtot <- subset(Totals, Totals$veg_type == "Native")
gtot <- subset(Totals, Totals$veg_type == "Invasive")

p5 <- ggplot(data = adtot, aes(y = length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = adtot, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = adtot, aes(x = Date, ymin=(length - se_length), ymax= (length + se_length), width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("0-40 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = gtot,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1), shape = 17,show.legend = F)+
  geom_errorbar(data = gtot, position = position_nudge(x = 10), aes(x = Date, ymin=(length - se_length), ymax= (length + se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("#E58601", "#E2D200"), guide =F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p5
grid.arrange(p1, p2, p3, p4, p5,   ncol=5)

#########LENGTH_BW###########

ad10 <- subset(zt10, zt10$site == "adenostoma")
g10 <- subset(zt10, zt10$site == "grass")

p1 <- ggplot(data = ad10, aes(y = mean_length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad10, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad10, aes(x = Date, ymin=(mean_length - sd_length), ymax=(mean_length +sd_length), width = 10,  colour = "Native") ) +
  ylab("") +
  xlab("") +
  ggtitle("0-10 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = g10,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1),shape = 17, show.legend = F)+
  geom_errorbar(data = g10, position = position_nudge(x = 10), aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("black","grey50"), guide = F) +
  theme_bw()+
  theme(plot.title = element_text(hjust = 0.5),
        text = element_text(size=18))
p1

# 10 -20
ad20 <- subset(tent20, tent20$site == "adenostoma")
g20 <- subset(tent20, tent20$site == "grass")

p2 <- ggplot(data = ad20, aes(y = mean_length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad20, aes(colour = "Native", size = 1),  show.legend = F)+
  geom_errorbar(data = ad20, aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 10,  colour = "Native") ) +
  ylab("") +
  xlab("") +
  ggtitle("10-20 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = g20,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1),shape = 17, show.legend = F)+
  geom_errorbar(data = g20, position = position_nudge(x = 10), aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("black","grey50"), guide = F) +
  theme_bw()+
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p2

### 20-30
ad30 <- subset(twent30, twent30$site == "adenostoma")
g30 <- subset(twent30, twent30$site == "grass")

p3 <- ggplot(data = ad30, aes(y = mean_length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad30, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = ad30, aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 10,  colour = "Native") ) +
  ylab("") +
  xlab("") +
  ggtitle("20-30 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = g30,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1), shape = 17, show.legend = F)+
  geom_errorbar(data = g30, position = position_nudge(x = 10), aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("black","grey50"), guide = F) +
  theme_bw()+
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p3

# 30-40
ad40 <- subset(thirt40, thirt40$site == "adenostoma")
g40 <- subset(thirt40, thirt40$site == "grass")

p4 <- ggplot(data = ad40, aes(y = mean_length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = ad40, aes(colour = "Native", size = 1),  show.legend = F)+
  geom_errorbar(data = ad40, aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 10,  colour = "Native") ) +
  ylab("") +
  xlab("") +
  ggtitle("30-40 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = g40,position = position_nudge(x = 10),  aes(colour = "Invasive", size = 1), shape = 17, show.legend = F)+
  geom_errorbar(data = g40, position = position_nudge(x = 10), aes(x = Date, ymin=(mean_length - se_length), ymax=(mean_length +se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("black","grey50"), guide = F) +
  theme_bw()+
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p4

adtot <- subset(Totals, Totals$veg_type == "Native")
gtot <- subset(Totals, Totals$veg_type == "Invasive")

p5 <- ggplot(data = adtot, aes(y = length, x = Date)) +
  scale_x_date(labels = date_format("%b-%y"), date_breaks = "2 month")+
  geom_point(data = adtot, aes(colour = "Native", size = 1), show.legend = F)+
  geom_errorbar(data = adtot, aes(x = Date, ymin=(length - se_length), ymax= (length + se_length), width = 10,  colour = "Native") ) +
  xlab("") +
  ggtitle("0-40 cm") +
  scale_y_continuous(limits = c(0, 25))+
  geom_point(data = gtot,position = position_nudge(x = 10), shape = 17, aes(colour = "Invasive", size = 1), show.legend = F)+
  geom_errorbar(data = gtot, position = position_nudge(x = 10), aes(x = Date, ymin=(length - se_length), ymax= (length + se_length), width = 15, colour = "Invasive") ) +
  scale_colour_manual("", breaks = c("Native", "Invasive"), values=c("black","grey50"), guide =F) +
  theme_bw() +
  theme(axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size=18),
        legend.position = "bottom")
p5
grid.arrange(p1, p2, p3, p4, p5,   ncol=5)
bmcnellis/SDEF.analysis documentation built on June 4, 2019, 10 a.m.