#Leaves analyses #https://momx.github.io/Momocs/articles/Momocs_intro.html #~~~ #1. Generate template for leaves morphometry #~~~ Plant_ID <- c("GH_1042", "GH_0501", "GH_0294", "", "", "", "", "", "", "") ##Template for leaves morphometry pdf(paste0("Input_sheets_leaves/Leaves_", Sys.Date(), "_C.pdf")) plot(x=0,y=1, xlim = c(0,6), ylim = c(-8,32), type = 'n', frame.plot=F, axes = F, xlab="", ylab="") #Establish grid # - 3 columns and 10 rows nrows <- 10 segments(x0=0, x1=6, y0=seq(0,30,by=3), y1=seq(0,30,by=3)) #Add the last line segments(x0=0, x1=6, y0=0, y1=0) ncols <- 3 for(i in 1:ncols){ segments(x0=i*2, x1=i*2, y0=0, y1=31) } #Label columns text(x=c(1,3,5), y=rep(31,3), c("Plant_ID", "A", "B"), cex=.8) #Add Plant_IDs text(x=rep(1, length(Plant_ID)), y=seq(from=1.5, to=30, by=3), Plant_ID, cex=.8) #Add dots to align petioles points(x=rep(3.5, nrows), y=seq(from=1.5, to=30, by=3), pch=16, cex=.4) points(x=rep(5.5, nrows), y=seq(from=1.5, to=30, by=3), pch=16, cex=.4) note <- "NOTE: Glue 2 leaves per ind. in each cell with abaxial surface up and position it horizontally with petiole on dot (stay as straight as possible). Scan @600dpi using lab computer and save file as jpg as follows: Leaves_sagebrush_stomata_project_YYYYMMDD.jpg." text(x=0, y=-3, paste(strwrap(note,width=150), collapse='\n'), cex=.5, adj=0) #Add date text(x=6, y=32.5, paste0("Date: ", Sys.Date()), cex=.6, adj=1) dev.off() #~~~ #2. Process scanned image of leaves #~~~ #Load packages require(magick) require(sp) require(image.ContourDetector) require(imager) require(Momocs) library(CropDetectR) library(imager) library(ggplot2) library(dplyr) library(reshape2) library(EBImage) library(stats) ###~~~ #Read masterfile in csv ###~~~ csv <- read.csv("DB_leaves_morpho_GH.csv") ###~~~ #Process images from scans - to BW ###~~~ for(i in 1:nrow(csv)){ #Load image img <- magick::image_read(paste(as.vector(csv$Folder[i]), "/", as.vector(csv$Scan_jpg[i]), sep='')) #Process A plantA <- magick::image_crop(img, as.vector(csv$Coordinates_A[i])) plantABW <- plantA %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plantABW, path = paste0("BW_leaves_individual/GH_", as.vector(csv$Seedling_ID[i]), "_A.jpg")) plantB <- magick::image_crop(img, as.vector(csv$Coordinates_B[i])) plantBBW <- plantB %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plantBBW, path = paste0("BW_leaves_individual/GH_", as.vector(csv$Seedling_ID[i]), "_B.jpg")) } ###~~~ #Morphometric analyses on processed images cleaned in Fiji ###~~~ # https://momx.github.io/Momocs/articles/Momocs_intro.html ### #Load csv with info on leaves ### csv <- read.csv("DB_leaves_morpho_GH.csv") #Add a pop col csv$Pop <- sapply(strsplit(as.vector(csv$Family_ID), "_"), "[[", 1) #Match images with pop (for plotting info) # This vector is used for mapping purposes facImg <- csv$Pop[match(sapply(strsplit(sapply(strsplit(imgL, split = "GH_"), "[[", 2), "_"), "[[", 1), csv$Seedling_ID)] ### #Load images in Momocs ### imgL <- list.files("BW_leaves_individual/", pattern = "_*.jpg", full.names = T) input <- Momocs::import_jpg(imgL) datL <- Momocs::Out(x = input, fac = facImg) ### #Put all images in same system = center ### datCent <- datL %>% coo_center %>% coo_scale %>% coo_alignxax() %>% coo_slidedirection("up") #Stack all images to observe variation pdf("Stack_panel_leaves.pdf") stack(datCent) panel(datCent, fac=~value, names=NULL) dev.off() #### #Fournier analysis of leaf morphologies ### datCent.f <- efourier(datCent, norm = T) #Apply model to infer PCA showing how leaf morph cluster datCent.p <- PCA(datCent.f) class(datCent.p) # a PCA object, let's plot it #Plot PCA by pop: IDT3 and IDT1 express most variability, # whereas the other pops are more coherent #pdf("PCA_fournier_leaves_pop.pdf") plot_PCA(datCent.p, ~value) Momocs::draw_axes(datCent.p) #dev.off() ### #Leaf areas ### #Infer shape area (in pixels) LeafArea <- coo_area(datL) #Convert to mm2 (= (pixel * 25.4)/dpi=600) LeafAreammsq <- (LeafArea * 25.4)/600 #Boxplot area by pop pdf("Figures/Leaf_area_mm_sq_boxplot.pdf") boxplot(LeafAreammsq ~ facImg, xlab = "Population", ylab = "Leaf area (mm2)") dev.off() #GLM GLMAreaPop <- glm(LeafAreammsq ~ facImg) #Tukey's test emmeans::emmeans(GLMAreaPop, specs = pairwise ~ facImg) #Kmeans analysis pdf("Figures/Kmeans_5_leaves.pdf") KMEANS(datCent.p, centers = 5) dev.off() #Clustering analysis #CLUST(datCent.p, ~value) ###~~~ #Code for Scanned_leaves/Leaves_sagebrush_stomata_project_20210608.jpg ###~~~ #Load image img <- magick::image_read("Scanned_leaves/Leaves_sagebrush_stomata_project_20210610.jpg") #Plant_ID: 1 plant1A <- magick::image_crop(img, "880x234+2070+3800") plant1ABW <- plant1A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant1ABW, path = paste0("Momocs/", Plant_ID[1], "_A.jpg")) plant1B <- magick::image_crop(img, "880x234+3285+3800") plant1BBW <- plant1B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant1BBW, path = paste0("Momocs/", Plant_ID[1], "_B.jpg")) #Plant_ID: 2 plant2A <- magick::image_crop(img, "880x234+2070+3557") plant2ABW <- plant2A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant2ABW, path = paste0("Momocs/", Plant_ID[2], "_A.jpg")) plant2B <- magick::image_crop(img, "880x234+3265+3557") plant2BBW <- plant2B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant2BBW, path = paste0("Momocs/", Plant_ID[2], "_B.jpg")) #Plant_ID: 3 plant3A <- magick::image_crop(img, "880x234+2080+3313") plant3ABW <- plant3A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant3ABW, path = paste0("Momocs/", Plant_ID[3], "_A.jpg")) plant3B <- magick::image_crop(img, "880x234+3265+3333") plant3BBW <- plant3B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant3BBW, path = paste0("Momocs/", Plant_ID[3], "_B.jpg")) #Plant_ID: 4 plant4A <- magick::image_crop(img, "880x234+2070+3065") plant4ABW <- plant4A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant4ABW, path = paste0("Momocs/", Plant_ID[4], "_A.jpg")) plant4B <- magick::image_crop(img, "880x234+3265+3087") plant4BBW <- plant4B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant4BBW, path = paste0("Momocs/", Plant_ID[4], "_B.jpg")) #Plant_ID: 5 plant5A <- magick::image_crop(img, "880x234+2070+2822") plant5ABW <- plant5A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant5ABW, path = paste0("Momocs/", Plant_ID[5], "_A.jpg")) plant5B <- magick::image_crop(img, "880x234+3265+2822") plant5BBW <- plant5B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant5BBW, path = paste0("Momocs/", Plant_ID[5], "_B.jpg")) #Plant_ID: 6 plant6A <- magick::image_crop(img, "880x234+2070+2578") plant6ABW <- plant6A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant6ABW, path = paste0("Momocs/", Plant_ID[6], "_A.jpg")) plant6B <- magick::image_crop(img, "880x234+3265+2578") plant6BBW <- plant6B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant6BBW, path = paste0("Momocs/", Plant_ID[6], "_B.jpg")) #Plant_ID: 7 plant7A <- magick::image_crop(img, "880x234+2070+2332") plant7ABW <- plant7A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant7ABW, path = paste0("Momocs/", Plant_ID[7], "_A.jpg")) plant7B <- magick::image_crop(img, "880x234+3265+2332") plant7BBW <- plant8B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant7BBW, path = paste0("Momocs/", Plant_ID[7], "_B.jpg")) #Plant_ID: 8 plant8A <- magick::image_crop(img, "880x234+2070+2142") plant8ABW <- plant8A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant8ABW, path = paste0("Momocs/", Plant_ID[8], "_A.jpg")) plant8B <- magick::image_crop(img, "880x234+3265+2087") plant8BBW <- plant8B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant8BBW, path = paste0("Momocs/", Plant_ID[8], "_B.jpg")) #Plant_ID: 9 plant9A <- magick::image_crop(img, "880x234+2070+1836") plant9ABW <- plant9A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant9ABW, path = paste0("Momocs/", Plant_ID[9], "_A.jpg")) plant9B <- magick::image_crop(img, "880x234+3265+1836") plant9BBW <- plant9B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant9BBW, path = paste0("Momocs/", Plant_ID[9], "_B.jpg")) #Plant_ID: 10 plant10A <- magick::image_crop(img, "880x234+2070+1593") plant10ABW <- plant10A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant10ABW, path = paste0("Momocs/", Plant_ID[10], "_A.jpg")) plant10B <- magick::image_crop(img, "880x234+3265+1593") plant10BBW <- plant10B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant10BBW, path = paste0("Momocs/", Plant_ID[10], "_B.jpg")) ###~~~ #Code for Scanned_leaves/Leaves_sagebrush_stomata_project_20210609.jpg ###~~~ Plant_ID <- c("GH_0836", "GH_1191", "GH_0143", "GH_0402", "GH_1117", "GH_0526", "GH_0268", "GH_0114", "GH_0727", "GH_0703") #Load image img <- magick::image_read("Scanned_leaves/Leaves_sagebrush_stomata_project_20210609.jpg") #Plant_ID: 1 plant1A <- magick::image_crop(img, "880x230+2060+3804") plant1ABW <- plant1A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant1ABW, path = paste0("Momocs/", Plant_ID[1], "_A.jpg")) plant1B <- magick::image_crop(img, "880x234+3265+3798") plant1BBW <- plant1B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant1BBW, path = paste0("Momocs/", Plant_ID[1], "_B.jpg")) #Plant_ID: 2 plant2A <- magick::image_crop(img, "880x234+2060+3618") plant2ABW <- plant2A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant2ABW, path = paste0("Momocs/", Plant_ID[2], "_A.jpg")) plant2B <- magick::image_crop(img, "880x234+3265+3618") plant2BBW <- plant2B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant2BBW, path = paste0("Momocs/", Plant_ID[2], "_B.jpg")) #Plant_ID: 3 plant3A <- magick::image_crop(img, "880x234+2070+3372") plant3ABW <- plant3A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant3ABW, path = paste0("Momocs/", Plant_ID[3], "_A.jpg")) plant3B <- magick::image_crop(img, "880x234+3265+3372") plant3BBW <- plant3B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant3BBW, path = paste0("Momocs/", Plant_ID[3], "_B.jpg")) #Plant_ID: 4 plant4A <- magick::image_crop(img, "880x234+2070+3128") plant4ABW <- plant4A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant4ABW, path = paste0("Momocs/", Plant_ID[4], "_A.jpg")) plant4B <- magick::image_crop(img, "880x234+3265+3122") plant4BBW <- plant4B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant4BBW, path = paste0("Momocs/", Plant_ID[4], "_B.jpg")) #Plant_ID: 5 plant5A <- magick::image_crop(img, "880x234+2070+2880") plant5ABW <- plant5A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant5ABW, path = paste0("Momocs/", Plant_ID[5], "_A.jpg")) plant5B <- magick::image_crop(img, "880x234+3265+2880") plant5BBW <- plant5B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant5BBW, path = paste0("Momocs/", Plant_ID[5], "_B.jpg")) #Plant_ID: 6 plant6A <- magick::image_crop(img, "880x234+2070+2636") plant6ABW <- plant6A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant6ABW, path = paste0("Momocs/", Plant_ID[6], "_A.jpg")) plant6B <- magick::image_crop(img, "880x234+3265+2636") plant6BBW <- plant6B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant6BBW, path = paste0("Momocs/", Plant_ID[6], "_B.jpg")) #Plant_ID: 7 plant7A <- magick::image_crop(img, "880x234+2070+2390") plant7ABW <- plant7A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant7ABW, path = paste0("Momocs/", Plant_ID[7], "_A.jpg")) plant7B <- magick::image_crop(img, "880x234+3265+2390") plant7BBW <- plant8B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant7BBW, path = paste0("Momocs/", Plant_ID[7], "_B.jpg")) #Plant_ID: 8 plant8A <- magick::image_crop(img, "880x234+2070+2142") plant8ABW <- plant8A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant8ABW, path = paste0("Momocs/", Plant_ID[8], "_A.jpg")) plant8B <- magick::image_crop(img, "880x234+3265+2142") plant8BBW <- plant8B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant8BBW, path = paste0("Momocs/", Plant_ID[8], "_B.jpg")) #Plant_ID: 9 plant9A <- magick::image_crop(img, "880x234+2070+1897") plant9ABW <- plant9A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant9ABW, path = paste0("Momocs/", Plant_ID[9], "_A.jpg")) plant9B <- magick::image_crop(img, "880x234+3265+1897") plant9BBW <- plant9B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant9BBW, path = paste0("Momocs/", Plant_ID[9], "_B.jpg")) #Plant_ID: 10 plant10A <- magick::image_crop(img, "880x234+2070+1648") plant10ABW <- plant10A %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant10ABW, path = paste0("Momocs/", Plant_ID[10], "_A.jpg")) plant10B <- magick::image_crop(img, "880x234+3265+1648") plant10BBW <- plant10B %>% magick::image_convert(colorspace = "Gray") %>% magick::image_threshold(type = "white", threshold = "56%") %>% magick::image_threshold(type = "black", threshold = "56%") #Write image magick::image_write(plant10BBW, path = paste0("Momocs/", Plant_ID[10], "_B.jpg")) Moc plot(imgBIN) imgBG <- image_fill(imgBW, "yellow", point = "+1+20", fuzz = 20) imgBW <- image_background(imgBW, color = "yellow") plot(imgBW) #Transform into gray scale mat <- magick::image_data(img, channels = "gray") mat <- magick::image_data(imgBW, channels = "gray") mat <- as.integer(mat, transpose = TRUE) mat <- drop(mat) #Contourlines countlines <- image_contour_detector(mat, Q=0) plot(countlines) ###OLD CODE#### #Add annotation text(x=0.6, y=8, paste0("Ind. #1: ", Plant_ID[1]), cex=.6, adj=c(1,1)) text(x=0.6, y=7.5, paste0("Ind. #2: ", Plant_ID[2]), cex=.6, adj=c(1,1)) text(x=0.6, y=7, paste0("Ind. #3: ", Plant_ID[3]), cex=.6, adj=c(1,1)) abline(h=4.5, col = "gray") abline(h=2.5, col = "gray") text(x=0.1, y=0.8+(5.5-4.5)/2, "Ind. #3", cex=.6, adj=1, srt=45) text(x=0.1, y=3.3+(5.5-4.5)/2, "Ind. #2", cex=.6, adj=1, srt=45) text(x=0.1, y=5.8+(5.5-4.5)/2, "Ind. #1", cex=.6, adj=1, srt=45) note <- "NOTE: Glue 2 leaves per ind. in each cell with abaxial surface up and position it horizontally with the petiole on the left dot and blade on the second dot (try to stay as straight as possible). Scan @600dpi using lab PC computer and save file as jpeg as follows: Leaves_sagebrush_stomata_project_MM_DD_YYYY.jpeg." text(x=0.05, y=0.1, paste(strwrap(note,width=115), collapse='\n'), cex=.6, adj=0) #Bottom row rect(xleft = 0.5, xright = 1.5, ybottom = 0.5, ytop = 1.5) rect(xleft = 3, xright = 4, ybottom = 0.5, ytop = 1.5) #Middle row rect(xleft = 0.5, xright = 1.5, ybottom = 3, ytop = 4) rect(xleft = 3, xright = 4, ybottom = 3, ytop = 4) #Top row rect(xleft = 0.5, xright = 1.5, ybottom = 5.5, ytop = 6.5) rect(xleft = 3, xright = 4, ybottom = 5.5, ytop = 6.5) #Add points in the middle of cells points(x=0.5+(1.5-0.5)/2, y=0.5+(5.5-4.5)/2, cex=.2) points(x=0.5+(1.5-0.5)/2, y=3+(5.5-4.5)/2, cex=.2) points(x=0.5+(1.5-0.5)/2, y=5.5+(6.5-5.5)/2, cex=.2) points(x=0.8+(1.5-0.5)/2, y=0.5+(5.5-4.5)/2, cex=.2) points(x=0.8+(1.5-0.5)/2, y=3+(5.5-4.5)/2, cex=.2) points(x=0.8+(1.5-0.5)/2, y=5.5+(6.5-5.5)/2, cex=.2) points(x=3+(1.5-0.5)/2, y=0.5+(5.5-4.5)/2, cex=.2) points(x=3+(1.5-0.5)/2, y=3+(5.5-4.5)/2, cex=.2) points(x=3+(1.5-0.5)/2, y=5.5+(6.5-5.5)/2, cex=.2) points(x=3.3+(1.5-0.5)/2, y=0.5+(5.5-4.5)/2, cex=.2) points(x=3.3+(1.5-0.5)/2, y=3+(5.5-4.5)/2, cex=.2) points(x=3.3+(1.5-0.5)/2, y=5.5+(6.5-5.5)/2, cex=.2) #Leaf label/rep text(x=0.3, y=0.5+(5.5-4.5)/2, "A") text(x=0.3, y=3+(5.5-4.5)/2, "A") text(x=0.3, y=5.5+(6.5-5.5)/2, "A") text(x=2.8, y=0.5+(5.5-4.5)/2, "B") text(x=2.8, y=3+(5.5-4.5)/2, "B") text(x=2.8, y=5.5+(6.5-5.5)/2, "B")