This notebook describes the preliminary analysis of root anatomical features - along the main root developmental axis - collected by Emilly Miller - working in Magda Julkowska’s lab at Boyce Thompson Institute, Ithaca, NY.

The analysis itself was performed by Magda Julkowska

Load data

data <- read.csv("20250318_MRCrossSectionData.csv")
data$Root.Area <- as.numeric(as.character(data$Root.Area))
data$Epidermis.Cell.Individual..1 <- as.numeric(as.character(data$Epidermis.Cell.Individual..1))
data$Epidermis.Cell.Individual..2 <- as.numeric(as.character(data$Epidermis.Cell.Individual..2))
data$Epidermis.Cell.Individual..3 <- as.numeric(as.character(data$Epidermis.Cell.Individual..3))
data$Epidermis.Cell.Individual..4 <- as.numeric(as.character(data$Epidermis.Cell.Individual..4))
data$Epidermis.Total <- as.numeric(as.character(data$Epidermis.Total))
data$Cortex.Cell.individual..1 <- as.numeric(as.character(data$Cortex.Cell.individual..1))
data$Cortex.Cell.individual..2 <- as.numeric(as.character(data$Cortex.Cell.individual..2))
data$Cortex.Cell.individual..3 <- as.numeric(as.character(data$Cortex.Cell.individual..3))
data$Cortex.Cell.individual..4 <- as.numeric(as.character(data$Cortex.Cell.individual..4))
data$Cortex.Total <- as.numeric(as.character(data$Cortex.Total))
data$Endodermis.Cell.Individual..1 <- as.numeric(as.character(data$Endodermis.Cell.Individual..1))
data$Endodermis.Cell.Individual..2 <- as.numeric(as.character(data$Endodermis.Cell.Individual..2))
data$Endodermis.Cell.Individual..3 <- as.numeric(as.character(data$Endodermis.Cell.Individual..3))
data$Endodermis.Cell.Individual..4 <- as.numeric(as.character(data$Endodermis.Cell.Individual..4))
data$Endodermis.Total <- as.numeric(as.character(data$Endodermis.Total)) 
data$Vasculature.Cell.Size.Individual..1 <- as.numeric(as.character(data$Vasculature.Cell.Size.Individual..1))
data$Vasculature.Cell.Size.Individual..2 <- as.numeric(as.character(data$Vasculature.Cell.Size.Individual..2))
data$Vasculature.Cell.Size.Individual..3 <- as.numeric(as.character(data$Vasculature.Cell.Size.Individual..3))
data$Vasculature.Cell.Size.Individual..4 <- as.numeric(as.character(data$Vasculature.Cell.Size.Individual..4))
data$Vasculature.Total <- as.numeric(as.character(data$Vasculature.Total))
data$Number.of.Cortex.Layers <- gsub("?", "", data$Number.of.Cortex.Layers)
data$Number.of.Cortex.Layers <- as.numeric(as.character(data$Number.of.Cortex.Layers))
## Warning: NAs introduced by coercion
data

Bulk data visualization:

OK - first let’s have a look at the overall root surface:

library(ggplot2)
library(ggpubr)
library(ggbeeswarm)
library(ggsci)
## Warning: package 'ggsci' was built under R version 4.3.3
my_comparisons <- list(c("MR_Proximal", "MR_Mid"), c("MR_Mid", "MR_Tip"), c("MR_Proximal", "MR_Tip"))
RootArea <- ggerrorplot(data, x = "Folder.Path", y = "Root.Area", color = "Folder.Path", fill = "Folder.Path",
                          desc_stat = "mean_sd", add = "jitter", ncol = 2,
                          xlab="", ylab= "Root Area (a.u.)", add.params = list(color = "darkgray"))  + color_palette("aaas")
RootArea <- RootArea + stat_compare_means(method = "aov", label.y = 3000000) 
RootArea <- RootArea + stat_compare_means(comparisons = my_comparisons)
RootArea <- RootArea + rremove("legend") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
RootArea
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).

OK - let’s check other bulk traits:

EpiArea <- ggerrorplot(data, x = "Folder.Path", y = "Epidermis.Total", color = "Folder.Path", fill = "Folder.Path",
                          desc_stat = "mean_sd", add = "jitter", ncol = 2,
                          xlab="", ylab= "Epidermis Area (a.u.)", add.params = list(color = "darkgray"))  + color_palette("aaas")
EpiArea <- EpiArea + stat_compare_means(method = "aov", label.y = 1000000) 
EpiArea <- EpiArea + stat_compare_means(comparisons = my_comparisons)
EpiArea <- EpiArea + rremove("legend") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
EpiArea
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_compare_means()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_signif()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).

CorArea <- ggerrorplot(data, x = "Folder.Path", y = "Cortex.Total", color = "Folder.Path", fill = "Folder.Path",
                          desc_stat = "mean_sd", add = "jitter", ncol = 2,
                          xlab="", ylab= "Cortex Area (a.u.)", add.params = list(color = "darkgray"))  + color_palette("aaas")
CorArea <- CorArea + stat_compare_means(method = "aov", label.y = 950000) 
CorArea <- CorArea + stat_compare_means(comparisons = my_comparisons)
CorArea <- CorArea + rremove("legend") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
CorArea
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_compare_means()`).
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_signif()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).

EndoArea <- ggerrorplot(data, x = "Folder.Path", y = "Endodermis.Total", color = "Folder.Path", fill = "Folder.Path",
                          desc_stat = "mean_sd", add = "jitter", ncol = 2,
                          xlab="", ylab= "Cortex Area (a.u.)", add.params = list(color = "darkgray"))  + color_palette("aaas")
EndoArea <- EndoArea + stat_compare_means(method = "aov", label.y = 400000) 
EndoArea <- EndoArea + stat_compare_means(comparisons = my_comparisons)
EndoArea <- EndoArea + rremove("legend") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
EndoArea
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_compare_means()`).
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_signif()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).

VascArea <- ggerrorplot(data, x = "Folder.Path", y = "Vasculature.Total", color = "Folder.Path", fill = "Folder.Path",
                          desc_stat = "mean_sd", add = "jitter", ncol = 2,
                          xlab="", ylab= "Vasculature Area (a.u.)", add.params = list(color = "darkgray"))  + color_palette("aaas")
VascArea <- VascArea + stat_compare_means(method = "aov", label.y = 600000) 
VascArea <- VascArea + stat_compare_means(comparisons = my_comparisons)
VascArea <- VascArea + rremove("legend") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
VascArea
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_compare_means()`).
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_signif()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).

Individual cell size visualization

OK - now let’s have a look at the individual cell sizes within each layer.

First - we need to melt the data frame:

library(reshape2)
data
data_melt <- melt(data, id=c("Image.Name", "Folder.Path"))
data_melt

now - we need to remove all of the ..1 to ..4:

data_melt$variable <- gsub("..1", "", data_melt$variable)
data_melt$variable <- gsub("..2", "", data_melt$variable)
data_melt$variable <- gsub("..3", "", data_melt$variable)
data_melt$variable <- gsub("..4", "", data_melt$variable)
data_melt

Now - let’s plot all of the variables just for the fun of it:

# we dont need all of the variables - especially count based ones:
unique(data_melt$variable)
##  [1] "Root.Area"                         "Epidermis.Cell.Individual"        
##  [3] "Epidermis.Total"                   "Cortex.Cell.individual"           
##  [5] "Cortex.Total"                      "Number.of.Cortex.Layers"          
##  [7] "Endodermis.Cell.Individual"        "Endodermis.Total"                 
##  [9] "Vasculature.Cell.Size.Individual"  "Vasculature.Total"                
## [11] "Xylem.Bundle.Sheath.Present.or.0." "Number.of.XBS"                    
## [13] "Surface.Area.of.XBS"               "Surface.Area.of.XBS.1"            
## [15] "Surface.Area.of.XB"                "Surface.Area.of.XBS.5"            
## [17] "Surface.Area.of.XBS.6"
bye <- c("Number.of.Cortex.Layers", "Xylem.Bundle.Sheath.Present.or.0.", "Number.of.XBS",
         "Surface.Area.of.XBS.5", "Surface.Area.of.XBS.6", "Surface.Area.of.XBS.7","Vasculature.Cell.Size.Individual")
data_melt2 <- subset(data_melt, !(data_melt$variable %in% bye))
data_melt2$variable <- gsub("Surface.Area.of.XBS.1", "Surface.Area.of.XB", data_melt2$variable)
data_melt2$variable <- gsub("Surface.Area.of.XBS", "Surface.Area.of.XB", data_melt2$variable)
data_melt2$value <- as.numeric(as.character(data_melt2$value))

data_melt2$Folder.Path <- factor(data_melt2$Folder.Path, levels = c("MR_Tip", "MR_Mid", "MR_Proximal"))
unique(data_melt2$variable)
## [1] "Root.Area"                  "Epidermis.Cell.Individual" 
## [3] "Epidermis.Total"            "Cortex.Cell.individual"    
## [5] "Cortex.Total"               "Endodermis.Cell.Individual"
## [7] "Endodermis.Total"           "Vasculature.Total"         
## [9] "Surface.Area.of.XB"
data_melt2$variable <- factor(data_melt2$variable, levels = c("Root.Area", "Epidermis.Total", "Cortex.Total", "Endodermis.Total", "Vasculature.Total", "Epidermis.Cell.Individual", "Cortex.Cell.individual", "Endodermis.Cell.Individual", "Surface.Area.of.XB"))

AllArea <- ggerrorplot(data_melt2, x = "variable", y = "value", color = "variable", fill = "variable",
                          desc_stat = "mean_sd", add = "jitter", ncol = 1, facet.by = "Folder.Path",
                          xlab="", ylab= "Area (a.u.)", add.params = list(color = "darkgray"))  + color_palette("aaas")
AllArea <- AllArea + stat_compare_means(method = "aov", label.y = 3000000) 
#AllArea <- AllArea + stat_compare_means(comparisons = my_comparisons)
AllArea <- AllArea + rremove("legend") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
AllArea
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_compare_means()`).
## Warning: Removed 106 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_segment()`).

Now - let’s add the sig. different groups to this graph:

library(stringr)
library(multcompView)

LR_Tip <- subset(data_melt2, data_melt2$Folder.Path == "MR_Tip")
LR_Mid <- subset(data_melt2, data_melt2$Folder.Path == "MR_Mid")
LR_Proximal <- subset(data_melt2, data_melt2$Folder.Path == "MR_Proximal")

LR_Tip$variable <- as.factor(LR_Tip$variable)
LR_Mid$variable <- as.factor(LR_Mid$variable)
LR_Proximal$variable <- as.factor(LR_Proximal$variable)
LR_Tip
Output <- TukeyHSD(aov(value ~ variable, data = LR_Tip))
Output$variable
##                                                               diff         lwr
## Epidermis.Total-Root.Area                            -1042269.8095 -1302599.04
## Cortex.Total-Root.Area                                -694123.1429 -1017021.82
## Endodermis.Total-Root.Area                           -1393876.1429 -1716774.82
## Vasculature.Total-Root.Area                          -1312651.1429 -1635549.82
## Epidermis.Cell.Individual-Root.Area                  -1457827.1929 -1663318.65
## Cortex.Cell.individual-Root.Area                     -1453661.5357 -1651395.78
## Endodermis.Cell.Individual-Root.Area                 -1460477.3929 -1665968.85
## Surface.Area.of.XB-Root.Area                         -1460003.5873 -1695815.44
## Cortex.Total-Epidermis.Total                           348146.6667    17273.98
## Endodermis.Total-Epidermis.Total                      -351606.3333  -682479.02
## Vasculature.Total-Epidermis.Total                     -270381.3333  -601254.02
## Epidermis.Cell.Individual-Epidermis.Total             -415557.3833  -633364.45
## Cortex.Cell.individual-Epidermis.Total                -411391.7262  -621895.91
## Endodermis.Cell.Individual-Epidermis.Total            -418207.5833  -636014.65
## Surface.Area.of.XB-Epidermis.Total                    -417733.7778  -664351.71
## Endodermis.Total-Cortex.Total                         -699753.0000 -1081811.86
## Vasculature.Total-Cortex.Total                        -618528.0000 -1000586.86
## Epidermis.Cell.Individual-Cortex.Total                -763704.0500 -1053414.53
## Cortex.Cell.individual-Cortex.Total                   -759538.3929 -1043799.28
## Endodermis.Cell.Individual-Cortex.Total               -766354.2500 -1056064.73
## Surface.Area.of.XB-Cortex.Total                       -765880.4444 -1077830.20
## Vasculature.Total-Endodermis.Total                      81225.0000  -300833.86
## Epidermis.Cell.Individual-Endodermis.Total             -63951.0500  -353661.53
## Cortex.Cell.individual-Endodermis.Total                -59785.3929  -344046.28
## Endodermis.Cell.Individual-Endodermis.Total            -66601.2500  -356311.73
## Surface.Area.of.XB-Endodermis.Total                    -66127.4444  -378077.20
## Epidermis.Cell.Individual-Vasculature.Total           -145176.0500  -434886.53
## Cortex.Cell.individual-Vasculature.Total              -141010.3929  -425271.28
## Endodermis.Cell.Individual-Vasculature.Total          -147826.2500  -437536.73
## Surface.Area.of.XB-Vasculature.Total                  -147352.4444  -459302.20
## Cortex.Cell.individual-Epidermis.Cell.Individual         4165.6571  -132828.65
## Endodermis.Cell.Individual-Epidermis.Cell.Individual    -2650.2000  -150620.96
## Surface.Area.of.XB-Epidermis.Cell.Individual            -2176.3944  -189995.02
## Endodermis.Cell.Individual-Cortex.Cell.individual       -6815.8571  -143810.16
## Surface.Area.of.XB-Cortex.Cell.individual               -6342.0516  -185640.49
## Surface.Area.of.XB-Endodermis.Cell.Individual             473.8056  -187344.82
##                                                              upr        p adj
## Epidermis.Total-Root.Area                             -781940.58 4.353726e-10
## Cortex.Total-Root.Area                                -371224.47 3.458049e-08
## Endodermis.Total-Root.Area                           -1070977.47 4.353689e-10
## Vasculature.Total-Root.Area                           -989752.47 4.353713e-10
## Epidermis.Cell.Individual-Root.Area                  -1252335.73 4.353682e-10
## Cortex.Cell.individual-Root.Area                     -1255927.29 4.353682e-10
## Endodermis.Cell.Individual-Root.Area                 -1254985.93 4.353682e-10
## Surface.Area.of.XB-Root.Area                         -1224191.74 4.353682e-10
## Cortex.Total-Epidermis.Total                           679019.35 3.140723e-02
## Endodermis.Total-Epidermis.Total                       -20733.65 2.852460e-02
## Vasculature.Total-Epidermis.Total                       60491.35 2.024132e-01
## Epidermis.Cell.Individual-Epidermis.Total             -197750.32 1.079176e-06
## Cortex.Cell.individual-Epidermis.Total                -200887.54 5.628991e-07
## Endodermis.Cell.Individual-Epidermis.Total            -200400.52 9.103739e-07
## Surface.Area.of.XB-Epidermis.Total                    -171115.84 1.989739e-05
## Endodermis.Total-Cortex.Total                         -317694.14 3.107753e-06
## Vasculature.Total-Cortex.Total                        -236469.14 5.297565e-05
## Epidermis.Cell.Individual-Cortex.Total                -473993.57 4.595735e-10
## Cortex.Cell.individual-Cortex.Total                   -475277.50 4.494447e-10
## Endodermis.Cell.Individual-Cortex.Total               -476643.77 4.564487e-10
## Surface.Area.of.XB-Cortex.Total                       -453930.69 8.055954e-10
## Vasculature.Total-Endodermis.Total                     463283.86 9.989746e-01
## Epidermis.Cell.Individual-Endodermis.Total             225759.43 9.986562e-01
## Cortex.Cell.individual-Endodermis.Total                224475.50 9.990514e-01
## Endodermis.Cell.Individual-Endodermis.Total            223109.23 9.982049e-01
## Surface.Area.of.XB-Endodermis.Total                    245822.31 9.989959e-01
## Epidermis.Cell.Individual-Vasculature.Total            144534.43 8.062206e-01
## Cortex.Cell.individual-Vasculature.Total               143250.50 8.147248e-01
## Endodermis.Cell.Individual-Vasculature.Total           141884.23 7.903412e-01
## Surface.Area.of.XB-Vasculature.Total                   164597.31 8.520421e-01
## Cortex.Cell.individual-Epidermis.Cell.Individual       141159.96 1.000000e+00
## Endodermis.Cell.Individual-Epidermis.Cell.Individual   145320.56 1.000000e+00
## Surface.Area.of.XB-Epidermis.Cell.Individual           185642.23 1.000000e+00
## Endodermis.Cell.Individual-Cortex.Cell.individual      130178.45 1.000000e+00
## Surface.Area.of.XB-Cortex.Cell.individual              172956.38 1.000000e+00
## Surface.Area.of.XB-Endodermis.Cell.Individual          188292.43 1.000000e+00
P7 = Output$variable[,'p adj']
stat.test<- multcompLetters(P7)
testc <- as.data.frame(stat.test$Letters)
testc$group2 <- rownames(testc)
testc$group1 <- rownames(testc)
testc$variable <- rownames(testc)
testc$variable <- rownames(testc)
colnames(testc)[1] <- "Tukey"
testc$Folder.Path <- "MR_Tip"
testc
Output <- TukeyHSD(aov(value ~ variable, data = LR_Mid))
Output$variable
##                                                               diff        lwr
## Epidermis.Total-Root.Area                            -1.138096e+06 -1516477.0
## Cortex.Total-Root.Area                               -1.040540e+06 -1434370.7
## Endodermis.Total-Root.Area                           -1.446697e+06 -1840528.6
## Vasculature.Total-Root.Area                          -1.268012e+06 -1661843.4
## Epidermis.Cell.Individual-Root.Area                  -1.632194e+06 -1931329.7
## Cortex.Cell.individual-Root.Area                     -1.632205e+06 -1931341.7
## Endodermis.Cell.Individual-Root.Area                 -1.634223e+06 -1945094.1
## Cortex.Total-Epidermis.Total                          9.755671e+04  -296274.4
## Endodermis.Total-Epidermis.Total                     -3.086011e+05  -702432.3
## Vasculature.Total-Epidermis.Total                    -1.299160e+05  -523747.1
## Epidermis.Cell.Individual-Epidermis.Total            -4.940972e+05  -793233.5
## Cortex.Cell.individual-Epidermis.Total               -4.941092e+05  -793245.4
## Endodermis.Cell.Individual-Epidermis.Total           -4.961263e+05  -806997.8
## Endodermis.Total-Cortex.Total                        -4.061578e+05  -814855.7
## Vasculature.Total-Cortex.Total                       -2.274727e+05  -636170.6
## Epidermis.Cell.Individual-Cortex.Total               -5.916539e+05  -910108.8
## Cortex.Cell.individual-Cortex.Total                  -5.916659e+05  -910120.7
## Endodermis.Cell.Individual-Cortex.Total              -5.936830e+05  -923185.8
## Vasculature.Total-Endodermis.Total                    1.786852e+05  -230012.7
## Epidermis.Cell.Individual-Endodermis.Total           -1.854961e+05  -503950.9
## Cortex.Cell.individual-Endodermis.Total              -1.855081e+05  -503962.9
## Endodermis.Cell.Individual-Endodermis.Total          -1.875252e+05  -517028.0
## Epidermis.Cell.Individual-Vasculature.Total          -3.641813e+05  -682636.1
## Cortex.Cell.individual-Vasculature.Total             -3.641932e+05  -682648.1
## Endodermis.Cell.Individual-Vasculature.Total         -3.662103e+05  -695713.1
## Cortex.Cell.individual-Epidermis.Cell.Individual     -1.196429e+01  -189202.3
## Endodermis.Cell.Individual-Epidermis.Cell.Individual -2.029071e+03  -209276.7
## Endodermis.Cell.Individual-Cortex.Cell.individual    -2.017107e+03  -209264.8
##                                                              upr        p adj
## Epidermis.Total-Root.Area                             -759715.54 1.215886e-10
## Cortex.Total-Root.Area                                -646708.41 1.474936e-10
## Endodermis.Total-Root.Area                           -1052866.24 1.214566e-10
## Vasculature.Total-Root.Area                           -874181.07 1.215006e-10
## Epidermis.Cell.Individual-Root.Area                  -1333057.26 1.214271e-10
## Cortex.Cell.individual-Root.Area                     -1333069.22 1.214271e-10
## Endodermis.Cell.Individual-Root.Area                 -1323351.07 1.214271e-10
## Cortex.Total-Epidermis.Total                           491387.88 9.944054e-01
## Endodermis.Total-Epidermis.Total                        85230.04 2.405053e-01
## Vasculature.Total-Epidermis.Total                      263915.21 9.701517e-01
## Epidermis.Cell.Individual-Epidermis.Total             -194960.97 4.090016e-05
## Cortex.Cell.individual-Epidermis.Total                -194972.94 4.087914e-05
## Endodermis.Cell.Individual-Epidermis.Total            -185254.78 8.320813e-05
## Endodermis.Total-Cortex.Total                            2540.08 5.267175e-02
## Vasculature.Total-Cortex.Total                         181225.25 6.722425e-01
## Epidermis.Cell.Individual-Cortex.Total                -273199.08 2.643401e-06
## Cortex.Cell.individual-Cortex.Total                   -273211.04 2.642042e-06
## Endodermis.Cell.Individual-Cortex.Total               -264180.21 5.667116e-06
## Vasculature.Total-Endodermis.Total                     587383.08 8.755543e-01
## Epidermis.Cell.Individual-Endodermis.Total             132958.75 6.192698e-01
## Cortex.Cell.individual-Endodermis.Total                132946.79 6.191920e-01
## Endodermis.Cell.Individual-Endodermis.Total            141977.62 6.468064e-01
## Epidermis.Cell.Individual-Vasculature.Total            -45726.41 1.359818e-02
## Cortex.Cell.individual-Vasculature.Total               -45738.38 1.359323e-02
## Endodermis.Cell.Individual-Vasculature.Total           -36707.54 1.849721e-02
## Cortex.Cell.individual-Epidermis.Cell.Individual       189178.41 1.000000e+00
## Endodermis.Cell.Individual-Epidermis.Cell.Individual   205218.60 1.000000e+00
## Endodermis.Cell.Individual-Cortex.Cell.individual      205230.56 1.000000e+00
P7 = Output$variable[,'p adj']
stat.test<- multcompLetters(P7)
testd <- as.data.frame(stat.test$Letters)
testd$group2 <- rownames(testd)
testd$group1 <- rownames(testd)
testd$variable <- rownames(testd)
testd$variable <- rownames(testd)
colnames(testd)[1] <- "Tukey"
testd$Folder.Path <- "MR_Mid"
testd
Output <- TukeyHSD(aov(value ~ variable, data = LR_Proximal))
Output$variable
##                                                             diff         lwr
## Epidermis.Total-Root.Area                             -603864.00  -626932.92
## Cortex.Total-Root.Area                                -697886.00  -720954.92
## Endodermis.Total-Root.Area                            -973424.00  -996492.92
## Vasculature.Total-Root.Area                           -810200.00  -833268.92
## Epidermis.Cell.Individual-Root.Area                  -1020067.00 -1038304.58
## Cortex.Cell.individual-Root.Area                     -1020628.25 -1038865.83
## Endodermis.Cell.Individual-Root.Area                 -1023210.25 -1041447.83
## Cortex.Total-Epidermis.Total                           -94022.00  -117090.92
## Endodermis.Total-Epidermis.Total                      -369560.00  -392628.92
## Vasculature.Total-Epidermis.Total                     -206336.00  -229404.92
## Epidermis.Cell.Individual-Epidermis.Total             -416203.00  -434440.58
## Cortex.Cell.individual-Epidermis.Total                -416764.25  -435001.83
## Endodermis.Cell.Individual-Epidermis.Total            -419346.25  -437583.83
## Endodermis.Total-Cortex.Total                         -275538.00  -298606.92
## Vasculature.Total-Cortex.Total                        -112314.00  -135382.92
## Epidermis.Cell.Individual-Cortex.Total                -322181.00  -340418.58
## Cortex.Cell.individual-Cortex.Total                   -322742.25  -340979.83
## Endodermis.Cell.Individual-Cortex.Total               -325324.25  -343561.83
## Vasculature.Total-Endodermis.Total                     163224.00   140155.08
## Epidermis.Cell.Individual-Endodermis.Total             -46643.00   -64880.58
## Cortex.Cell.individual-Endodermis.Total                -47204.25   -65441.83
## Endodermis.Cell.Individual-Endodermis.Total            -49786.25   -68023.83
## Epidermis.Cell.Individual-Vasculature.Total           -209867.00  -228104.58
## Cortex.Cell.individual-Vasculature.Total              -210428.25  -228665.83
## Endodermis.Cell.Individual-Vasculature.Total          -213010.25  -231247.83
## Cortex.Cell.individual-Epidermis.Cell.Individual         -561.25   -12095.71
## Endodermis.Cell.Individual-Epidermis.Cell.Individual    -3143.25   -14677.71
## Endodermis.Cell.Individual-Cortex.Cell.individual       -2582.00   -14116.46
##                                                               upr        p adj
## Epidermis.Total-Root.Area                             -580795.085 5.449526e-10
## Cortex.Total-Root.Area                                -674817.085 5.449526e-10
## Endodermis.Total-Root.Area                            -950355.085 5.449526e-10
## Vasculature.Total-Root.Area                           -787131.085 5.449526e-10
## Epidermis.Cell.Individual-Root.Area                  -1001829.421 5.449526e-10
## Cortex.Cell.individual-Root.Area                     -1002390.671 5.449526e-10
## Endodermis.Cell.Individual-Root.Area                 -1004972.671 5.449526e-10
## Cortex.Total-Epidermis.Total                           -70953.085 1.396213e-06
## Endodermis.Total-Epidermis.Total                      -346491.085 5.471159e-10
## Vasculature.Total-Epidermis.Total                     -183267.085 2.639739e-09
## Epidermis.Cell.Individual-Epidermis.Total             -397965.421 5.449526e-10
## Cortex.Cell.individual-Epidermis.Total                -398526.671 5.449526e-10
## Endodermis.Cell.Individual-Epidermis.Total            -401108.671 5.449526e-10
## Endodermis.Total-Cortex.Total                         -252469.085 7.491844e-10
## Vasculature.Total-Cortex.Total                         -89245.085 3.019059e-07
## Epidermis.Cell.Individual-Cortex.Total                -303943.421 5.451838e-10
## Cortex.Cell.individual-Cortex.Total                   -304504.671 5.451738e-10
## Endodermis.Cell.Individual-Cortex.Total               -307086.671 5.451332e-10
## Vasculature.Total-Endodermis.Total                     186292.915 7.070043e-09
## Epidermis.Cell.Individual-Endodermis.Total             -28405.421 6.892572e-05
## Cortex.Cell.individual-Endodermis.Total                -28966.671 6.248189e-05
## Endodermis.Cell.Individual-Endodermis.Total            -31548.671 4.024712e-05
## Epidermis.Cell.Individual-Vasculature.Total           -191629.421 8.486766e-10
## Cortex.Cell.individual-Vasculature.Total              -192190.671 8.404826e-10
## Endodermis.Cell.Individual-Vasculature.Total          -194772.671 8.052287e-10
## Cortex.Cell.individual-Epidermis.Cell.Individual        10973.208 9.999991e-01
## Endodermis.Cell.Individual-Epidermis.Cell.Individual     8391.208 9.537219e-01
## Endodermis.Cell.Individual-Cortex.Cell.individual        8952.458 9.831754e-01
P7 = Output$variable[,'p adj']
stat.test<- multcompLetters(P7)
teste <- as.data.frame(stat.test$Letters)
teste$group2 <- rownames(teste)
teste$group1 <- rownames(teste)
teste$variable <- rownames(teste)
teste$variable <- rownames(teste)
colnames(teste)[1] <- "Tukey"
teste$Folder.Path <- "MR_Proximal"
teste
test <- rbind(testc, testd, teste)
test
AllArea <- AllArea + stat_pvalue_manual(test, label = "Tukey", y.position = 2000000)
AllArea
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_compare_means()`).
## Warning: Removed 106 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_segment()`).

pdf("Area_All_facet_per_Root_segment-new.pdf", height = 15, width = 7)
plot(AllArea)
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_compare_means()`).
## Warning: Removed 106 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_segment()`).
dev.off()
## quartz_off_screen 
##                 2

OK - let’s try another way to plot this:

AllArea2 <- ggerrorplot(data_melt2, x = "Folder.Path", y = "value", color = "Folder.Path", fill = "Folder.Path",
                          desc_stat = "mean_sd", add = "jitter", facet.by = "variable", scales="free", ncol = 5,
                          xlab="", ylab= "Area (a.u.)", add.params = list(color = "darkgray"))  + color_palette("aaas")
AllArea2 <- AllArea2 + stat_compare_means(method = "aov") 
AllArea2 <- AllArea2 + stat_compare_means(comparisons = my_comparisons)
AllArea2 <- AllArea2 + rremove("legend") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
AllArea2
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_compare_means()`).
## Warning: Computation failed in `stat_compare_means()`.
## Caused by error in `contrasts<-`:
## ! contrasts can be applied only to factors with 2 or more levels
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_signif()`).
## Warning: Removed 106 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).

pdf("Area_All_facet_within_Root_segment-new.pdf", height = 7, width = 10)
plot(AllArea2)
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_compare_means()`).
## Warning: Computation failed in `stat_compare_means()`.
## Caused by error in `contrasts<-`:
## ! contrasts can be applied only to factors with 2 or more levels
## Warning: Removed 106 rows containing non-finite outside the scale range
## (`stat_signif()`).
## Warning: Removed 106 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
dev.off()
## quartz_off_screen 
##                 2