#load data & libaries library(smatr) # rm(list=ls()) # data4 <- read.csv('Trait data, 5-2-2014.csv', header = T, sep = ",") data4 <- read.csv('Trait data.csv', header = T, sep = ",") # _______________________ PLOTTING _____________________________________________### cool_dry <- subset (data4, climate.description == "Temperate_Dry", select = colnames(data4)) warm_wet <- subset (data4, climate.description == "Subtropical_Wet", select = colnames(data4)) hot_dry <- subset (data4, climate.description == "Tropical_Monsoonal", select = colnames(data4)) warm_arid <- subset (data4, climate.description == "Subtropical_Arid", select = colnames(data4)) warm_dry <- subset (data4, climate.description == "Subtropical_Dry", select = colnames(data4)) # ______________Fig 1, panel a (Gs ~ calculated KLA_pet)__________________________________________## ## TURN ON IF SAVING TO FILE tiff(file="KLA vs Gs, A.tiff", height=8, width=9, units="in", res=200) # pdf("KLA vs Gs, A.pdf", height=4.5, width=9) #postscript("myplot.eps", horizontal = FALSE, onefile = FALSE, paper = "special", height = 4.5, width = 5) par(mfrow=c(2,2), oma=c(0.5, 0.5, 0.5, 0.5), mai=c(0.7, 1, 0.3, 0.3), mgp=c(2.5, 0.5, 0)) # par(mfrow=c(1,1), oma=c(0.5, 0.5, 0.5, 0.5), mai=c(1, 0.9, 0.5, 0.5), mgp=c(2.2,0.5,0)) plot(data4[,"K.LA_pet..mg.s.m.m2."], data4[,"gs.adj."],axes=FALSE, pch=19, cex.lab=1.2, cex=1.5, cex.axis=1, log="xy", col="white", xlim=c(5, 900), ylim=c(0.031, 0.80), xlab=expression(bold("calculated ")*K[L] * " (mg " * s^-1 *" "* m^-2*" "*MPa^-1*")"), ylab=expression(g[S]*" (mmol " * m^-2 *" "*s^-1*")")) axis(1, tick=TRUE, line=0, tck=0.025, cex.axis=1) axis(2, tick=TRUE, line=0, las=2, tck=0.025, cex.axis=1) box(bty="l") points(cool_dry[,"K.LA_pet..mg.s.m.m2."], cool_dry[,"gs.adj."], pch=0, cex=1.2, col="blue",lwd=2) points(warm_wet[,"K.LA_pet..mg.s.m.m2."], warm_wet[,"gs.adj."], pch=1, cex=1.2, col="darkorchid3",lwd=2) points(hot_dry[,"K.LA_pet..mg.s.m.m2."], hot_dry[,"gs.adj."], pch=2, cex=1.2, col="red",lwd=2) points(warm_arid[,"K.LA_pet..mg.s.m.m2."], warm_arid[,"gs.adj."], pch=3, cex=1.2, col="darkorchid3",lwd=2) points(warm_dry[,"K.LA_pet..mg.s.m.m2."], warm_dry[,"gs.adj."], pch=5, cex=1.2, col="darkorchid3",lwd=2) SMA1 <- sma(log10(data4[,"gs.adj."])~log10(data4[,"K.LA_pet..mg.s.m.m2."]), slope.test=1, method="SMA",lwd=2) coef <- data.frame(coef(SMA1)) curve(10^((log10(x)*(coef[2,1])+(coef[1,1]))), lwd=1, add=T, xlim=c(6, 900), col="black") summary(SMA1) # also performing test to see if slope is significantly different from 1 # compare group to see if they are "shifted" along a common slope SMA2 <- sma(log10(data4[,"gs.adj."])~log10(data4[,"K.LA_pet..mg.s.m.m2."])+data4[,"location"], type="shift", method="SMA") summary(SMA2) # proportionality line curve((x)*(.007), lwd=1, lty=2, add=T, xlim=c(6, 900), col="red") # title(main = expression("petiole ~ branch"), sub = NULL, xlab = NULL, ylab = NULL, # line = NA, outer = FALSE, cex.main=1.7) lm <- lm(log10(data4[,"gs.adj."]) ~ log10(data4[,"K.LA_pet..mg.s.m.m2."])); summary(lm) text <- expression("a) " * r^2 * " = 0.16, p = 0.022") legend("topleft", text, bty="n") # ______________Fig 1, panel b (Amax ~ calculated KLA_pet)__________________________________________## plot(data4[,"K.LA_pet..mg.s.m.m2."], data4[,"Aarea"],axes=FALSE, pch=19, cex.lab=1.2, cex=1.5, cex.axis=1, log="xy", col="white", xlim=c(5, 900), ylim=c(3, 40), xlab=expression(bold("calculated ")*K[L] * " (mg " * s^-1 *" "* m^-2*" "*MPa^-1*")"), ylab=expression("Amax (" * mu * mol * " " * m^-2 * " " * s^-1 * ")")) axis(1, tick=TRUE, line=0, tck=0.025, cex.axis=1) axis(2, tick=TRUE, line=0, las=2, tck=0.025, cex.axis=1) box(bty="l") points(cool_dry[,"K.LA_pet..mg.s.m.m2."], cool_dry[,"Aarea"], pch=0, cex=1.2, col="blue",lwd=2) points(warm_wet[,"K.LA_pet..mg.s.m.m2."], warm_wet[,"Aarea"], pch=1, cex=1.2, col="darkorchid3",lwd=2) points(hot_dry[,"K.LA_pet..mg.s.m.m2."], hot_dry[,"Aarea"], pch=2, cex=1.2, col="red",lwd=2) points(warm_arid[,"K.LA_pet..mg.s.m.m2."], warm_arid[,"Aarea"], pch=3, cex=1.2, col="darkorchid3",lwd=2) points(warm_dry[,"K.LA_pet..mg.s.m.m2."], warm_dry[,"Aarea"], pch=5, cex=1.2, col="darkorchid3",lwd=2) OLS1=line.cis(log10(data4[,"Aarea"]), log10(data4[,"K.LA_pet..mg.s.m.m2."]), method="OLS") # curve(10^((log10(x)*(OLS1[2,1])+(OLS1[1,1]))), lwd=1, add=T, xlim=c(6, 900)) # title(main = expression("petiole ~ branch"), sub = NULL, xlab = NULL, ylab = NULL, # line = NA, outer = FALSE, cex.main=1.7) lm <- lm(log10(data4[,"Aarea"]) ~ log10(data4[,"K.LA_pet..mg.s.m.m2."])); summary(lm) text <- expression("b) " * r^2 * " = 0.09, p = 0.084") legend("topleft", text, bty="n") # ______________Fig 1, panel c (Gs ~ measured KLA)__________________________________________## plot(data4[,"K.max..mmol.m2.a.Mpa."]*18, data4[,"gs.adj."],axes=FALSE, pch=19, cex.lab=1.2, cex=1.5, cex.axis=1, log="xy", col="white", xlim=c(31, 500), ylim=c(0.06, 0.8), xlab=expression(bold("measured") *" "* K[L] * " (mg " * s^-1 *" "* m^-2*" "*MPa^-1*")"), ylab=expression(g[S]*" (mmol " * m^-2 *" "*s^-1*")")) axis(1, tick=TRUE, line=0, tck=0.025, cex.axis=1) axis(2, tick=TRUE, line=0, las=2, tck=0.025, cex.axis=1) box(bty="l") points(cool_dry[,"K.max..mmol.m2.a.Mpa."]*18, cool_dry[,"gs.adj."], pch=0, cex=1.2, col="blue",lwd=2) points(warm_wet[,"K.max..mmol.m2.a.Mpa."]*18, warm_wet[,"gs.adj."], pch=1, cex=1.2, col="darkorchid3",lwd=2) points(hot_dry[,"K.max..mmol.m2.a.Mpa."]*18, hot_dry[,"gs.adj."], pch=2, cex=1.2, col="red",lwd=2) points(warm_arid[,"K.max..mmol.m2.a.Mpa."]*18, warm_arid[,"gs.adj."], pch=3, cex=1.2, col="darkorchid3",lwd=2) points(warm_dry[,"K.max..mmol.m2.a.Mpa."]*18, warm_dry[,"gs.adj."], pch=5, cex=1.2, col="darkorchid3",lwd=2) SMA1 <- sma(log10(data4[,"gs.adj."])~log10(data4[,"K.max..mmol.m2.a.Mpa."]*18), slope.test=1, method="SMA") coef <- data.frame(coef(SMA1)) # curve(10^((log10(x)*(coef[2,1])+(coef[1,1]))), lwd=1, add=T, xlim=c(40, 400), col="black") summary(SMA1) # also performing test to see if slope is significantly different from 1 # compare group to see if they are "shifted" along a common slope SMA2 <- sma(log10(data4[,"gs.adj."])~log10(data4[,"K.max..mmol.m2.a.Mpa."]*18)+data4[,"location"], type="shift", method="SMA") summary(SMA2) # proportionality line # curve((x)*(.0023), lwd=1, lty=2, add=T, xlim=c(40, 300), col="red") # title(main = expression("petiole ~ branch"), sub = NULL, xlab = NULL, ylab = NULL, # line = NA, outer = FALSE, cex.main=1.7) lm <- lm(log10(data4[,"gs.adj."]) ~ log10(data4[,"K.max..mmol.m2.a.Mpa."]*18)); summary(lm) text <- expression("c) " * r^2 * " = 0.06, p = 0.146") legend("topleft", text, bty="n") # ______________Fig 1, panel d (Amax ~ measured KLA)__________________________________________## plot(data4[,"K.max..mmol.m2.a.Mpa."]*18, data4[,"Aarea"],axes=FALSE, pch=19, cex.lab=1.2, cex=1.5, cex.axis=1, log="xy", col="white", xlim=c(31, 500), ylim=c(6, 35), xlab=expression(bold("measured")*" "* K[L] * " (mg " * s^-1 *" "* m^-2*" "*MPa^-1*")"), ylab=expression("Amax (" * mu * mol * " " * m^-2 * " " * s^-1 * ")")) axis(1, tick=TRUE, line=0, tck=0.025, cex.axis=1) axis(2, tick=TRUE, line=0, las=2, tck=0.025, cex.axis=1) box(bty="l") points(cool_dry[,"K.max..mmol.m2.a.Mpa."]*18, cool_dry[,"Aarea"], pch=0, cex=1.2, col="blue",lwd=2) points(warm_wet[,"K.max..mmol.m2.a.Mpa."]*18, warm_wet[,"Aarea"], pch=1, cex=1.2, col="darkorchid3",lwd=2) points(hot_dry[,"K.max..mmol.m2.a.Mpa."]*18, hot_dry[,"Aarea"], pch=2, cex=1.2, col="red",lwd=2) points(warm_arid[,"K.max..mmol.m2.a.Mpa."]*18, warm_arid[,"Aarea"], pch=3, cex=1.2, col="darkorchid3",lwd=2) points(warm_dry[,"K.max..mmol.m2.a.Mpa."]*18, warm_dry[,"Aarea"], pch=5, cex=1.2, col="darkorchid3",lwd=2) SMA1 <- sma(log10(data4[,"Aarea"])~log10(data4[,"K.max..mmol.m2.a.Mpa."]*18), slope.test=1, method="SMA") coef <- data.frame(coef(SMA1)) curve(10^((log10(x)*(coef[2,1])+(coef[1,1]))), lwd=1, add=T, xlim=c(40, 500), col="black") summary(SMA1) # also performing test to see if slope is significantly different from 1 lm <- lm(log10(data4[,"Aarea"]) ~ log10(data4[,"K.max..mmol.m2.a.Mpa."]*18)); summary(lm) text <- expression("d) " * r^2 * " = 0.21, p = 0.005") legend("topleft", text, bty="n") # TURN ON/OFF dev.off()