library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.6 v dplyr 1.0.8
## v tidyr 1.2.0 v stringr 1.4.0
## v readr 2.1.2 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(dplyr)
library(viridis) #Scale-fill for ggplot
## Loading required package: viridisLite
library(ggplot2)
library(gridExtra)
##
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
##
## combine
licor <- read.csv("survey_data_all.csv")
survey <- select(licor, Date, ID, species, treatment, Photo, Cond, intr_WUE)
head(survey)
## Date ID species treatment Photo Cond intr_WUE
## 1 6/17/2021 1_9 CADE 1 4.721591 0.1697698 27.81172
## 2 6/17/2021 1_9 CADE 1 4.705655 0.1696595 27.73588
## 3 6/17/2021 1_9 CADE 1 4.729064 0.1693684 27.92176
## 4 6/17/2021 1_9 CADE 1 4.741632 0.1691572 28.03092
## 5 6/17/2021 1_9 CADE 1 4.743628 0.1689852 28.07126
## 6 6/9/2021 1_9 CADE 1 9.568417 0.2922992 32.73501
#### Establish Black Theme #### I use this customized black theme for presentations since my slides are black
theme_black = function(base_size = 12, base_family = "") {
theme_grey(base_size = base_size, base_family = base_family) %+replace%
theme(
# Specify axis options
axis.line = element_blank(),
axis.text.x = element_text(size = base_size*0.8, color = "white", lineheight = 0.9),
axis.text.y = element_text(size = base_size*0.8, color = "white", lineheight = 0.9),
axis.ticks = element_line(color = "white", size = 0.2),
axis.title.x = element_text(size = base_size, color = "white", margin = margin(0, 10, 0, 0)),
axis.title.y = element_text(size = base_size, color = "white", angle = 90, margin = margin(0, 10, 0, 0)),
axis.ticks.length = unit(0.3, "lines"),
# Specify legend options
legend.background = element_rect(color = NA, fill = "black"),
legend.key = element_rect(color = "white", fill = "black"),
legend.key.size = unit(1.2, "lines"),
legend.key.height = NULL,
legend.key.width = NULL,
legend.text = element_text(size = base_size*0.8, color = "white"),
legend.title = element_text(size = base_size*0.8, face = "bold", hjust = 0, color = "white"),
legend.position = "right",
legend.text.align = NULL,
legend.title.align = NULL,
legend.direction = "vertical",
legend.box = NULL,
# Specify panel options
panel.background = element_rect(fill = "black", color = NA),
panel.border = element_rect(fill = NA, color = "white"),
panel.grid.major = element_line(color = "black"), #can change color for gridlines
panel.grid.minor = element_line(color = "black"),
panel.margin = unit(0.5, "lines"),
# Specify facetting options
strip.background = element_rect(fill = "grey30", color = "grey10"),
strip.text.x = element_text(size = base_size*0.8, color = "white"),
strip.text.y = element_text(size = base_size*0.8, color = "white",angle = -90),
# Specify plot options
plot.background = element_rect(color = "black", fill = "black"),
plot.title = element_text(size = base_size*1.2, color = "white"),
plot.margin = unit(rep(1, 4), "lines")
)
}
#### All species photosynthesis
ggplot(survey, aes(x=Date, y=Photo, fill = species, color = species)) + geom_boxplot() +
scale_fill_manual(values=c("darkslategray", "antiquewhite4","goldenrod")) +
scale_color_manual(values = c("white", "white", "white"))+
ylab(bquote('A ('*mu~ 'mol' ~CO[2]~ m^-2~s^-1*')')) +
facet_wrap(~species) +
scale_y_continuous(name = "Photosynthetic Capacity") +
theme_black() +
theme(strip.background = element_blank(), strip.text.x = element_text(size = 20, color = "white", face = "bold"),
axis.text.x=element_text(angle = 60, vjust = 0.5, size = 15),
axis.text.y=element_text(size = 15),
axis.title.y.left = element_text(size = 20, vjust = 2),
axis.title.y.right = element_text(size = 20, vjust = 4),
axis.title.x = element_blank())
## Warning: `panel.margin` is deprecated. Please use `panel.spacing` property
## instead
#### All species photosynthesis
ggplot(survey, aes(x=Date, y=Photo, fill = species, color = species)) + geom_boxplot() +
scale_fill_manual(values=c("darkslategray", "antiquewhite4","goldenrod")) +
ylab(bquote('A ('*mu~ 'mol' ~CO[2]~ m^-2~s^-1*')')) +
facet_wrap(~species) +
scale_y_continuous(name = "Photosynthetic Capacity") +
theme_dark() +
theme(strip.background = element_blank(), strip.text.x = element_text(size = 20, color = "black", face = "bold"),
axis.text.x=element_text(angle = 60, vjust = 0.5, size = 15),
axis.text.y=element_text(size = 15),
axis.title.y.left = element_text(size = 20, vjust = 2),
axis.title.y.right = element_text(size = 20, vjust = 4),
axis.title.x = element_blank())