This code is the PhotosynQ analysis for cowpea screen 3, performed from April 21st through May 5th, 2022. Measurements were taken twice, April 27th and May 4th 2022.

#load libraries
library("ggplot2")
library("cowplot")
library("ggpubr")
## 
## Attaching package: 'ggpubr'
## The following object is masked from 'package:cowplot':
## 
##     get_legend
library("reshape2")

##Loading and organizing the data

#load csv file
getwd()
## [1] "C:/Users/J Lab/Box/Plant Architecture Lab/Hayley/Cowpea/Cowpea_screen_03_20220421-0505/Cowpea_Phenotype_exp3_analysis"
list.files(pattern=".csv")
## [1] "EVT_exp3.csv"       "FWDWWC_exp3.csv"    "Photosynq_exp3.csv"
## [4] "pot_geno_exp3.csv"
exp3_photo <- read.csv("Photosynq_exp3.csv")
exp3_photo
pot_geno3 <- read.csv("pot_geno_exp3.csv")
pot_geno3
#we are interested in: Pot.Number, Treatment, time, FoPrime, PhiNPQ, FvP_over_FmP, FmPrime, PS1.Active.Centers, PS1.Open.Centers, PS1.Over.Reduced.Centers, PS1.Oxidized.Centers, leaf_thickness, Leaf.Temperature, SPAD
photo3_interest <- exp3_photo[,c(3:5, 26, 28, 32:33, 35:38, 42, 48, 52)]
photo_geno_3exp <- merge(photo3_interest, pot_geno3, all = TRUE)
photo_geno_3exp <- na.omit(photo_geno_3exp)
photo_geno_3exp
photo_geno_3exp$time <- as.factor(photo_geno_3exp$time)
photo_geno_3exp$day.of.stress <- photo_geno_3exp$time
photo_geno_3exp$day.of.stress <- gsub("5/4/2022", "14", photo_geno_3exp$day.of.stress)
photo_geno_3exp$day.of.stress <- gsub("4/27/2022", "7", photo_geno_3exp$day.of.stress)
colnames(photo_geno_3exp)
##  [1] "Pot.Number"               "Treatment"               
##  [3] "time"                     "FoPrime"                 
##  [5] "PhiNPQ"                   "FvP_over_FmP"            
##  [7] "FmPrime"                  "PS1.Active.Centers"      
##  [9] "PS1.Open.Centers"         "PS1.Over.Reduced.Centers"
## [11] "PS1.Oxidized.Centers"     "leaf_thickness"          
## [13] "Leaf.Temperature"         "SPAD"                    
## [15] "Genotype"                 "day.of.stress"
photo_geno_3exp <- photo_geno_3exp[,c(1:2, 15:16, 4:14)]
photo_geno_3exp$day.of.stress <- as.numeric(photo_geno_3exp$day.of.stress)
photo_geno_3exp
#write.csv(photo_geno_3exp, "photosynQ_geno_exp3.csv", row.names = TRUE)

###Histograms

FoPrime_exp3_h <- gghistogram(photo_geno_3exp, x = "FoPrime", binwidth = 20,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("FoPrime (a.u)")
FoPrime_exp3_h

FmPrime_exp3_h <- gghistogram(photo_geno_3exp, x = "FmPrime", binwidth = 100,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("FmPrime (a.u)")
FmPrime_exp3_h

FvP_over_FmP_exp3_h <- gghistogram(photo_geno_3exp, x = "FvP_over_FmP", binwidth = 0.01,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("FvP over FmP (a.u)")
FvP_over_FmP_exp3_h

leaftemp_exp3_h <- gghistogram(photo_geno_3exp, x = "Leaf.Temperature", binwidth = 0.5,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("Leaf Temperature (C)")
leaftemp_exp3_h

leafthickness_exp3_h <- gghistogram(photo_geno_3exp, x = "leaf_thickness", binwidth = 0.05,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("Leaf Thickness (mm)")
leafthickness_exp3_h

PhiNPQ_exp3_h <- gghistogram(photo_geno_3exp, x = "PhiNPQ", binwidth = 0.01,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PhiNPQ (a.u.)")
PhiNPQ_exp3_h

PS1.Active.Centers_exp3_h <- gghistogram(photo_geno_3exp, x = "PS1.Active.Centers", binwidth = 1,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PS1.Active.Centers (a.u.)")
PS1.Active.Centers_exp3_h

PS1.Open.Centers_exp3_h <- gghistogram(photo_geno_3exp, x = "PS1.Open.Centers",
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PS1.Open.Centers (a.u.)")
## Warning: Using `bins = 30` by default. Pick better value with the argument
## `bins`.
PS1.Open.Centers_exp3_h

PS1.Over.Reduced.Centers_exp3_h <- gghistogram(photo_geno_3exp, x = "PS1.Over.Reduced.Centers",
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PS1.Over.Reduced.Centers (a.u.)")
## Warning: Using `bins = 30` by default. Pick better value with the argument
## `bins`.
PS1.Over.Reduced.Centers_exp3_h

PS1.Oxidized.Centers_exp3_h <- gghistogram(photo_geno_3exp, x = "PS1.Oxidized.Centers",
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("PS1.Oxidized.Centers (a.u.)")
## Warning: Using `bins = 30` by default. Pick better value with the argument
## `bins`.
PS1.Oxidized.Centers_exp3_h

SPAD_exp3_h <- gghistogram(photo_geno_3exp, x = "SPAD", binwidth = 2.5,
                            add = "mean", rug = TRUE,
                            color = "Treatment", fill = "Treatment", facet.by = "day.of.stress",
                            palette = c("blue", "orange")) + xlab("SPAD (a.u.)")
SPAD_exp3_h