resources: adding equation and r2 to figur (I am using the ggpubr package) https://www.roelpeters.be/how-to-add-a-regression-equation-and-r-squared-in-ggplot2/
General overview: How do field measurements compare to cloud compare estimates of canopy size, plant height, and volume? how does this differ by cloud compare technique? Finally, how do estimates differ by species?
library the tidyverse and ggpubr for figures
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.2 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.6 v dplyr 1.0.7
## v tidyr 1.2.0 v stringr 1.4.0
## v readr 2.1.2 v forcats 0.5.1
## Warning: package 'ggplot2' was built under R version 4.0.5
## Warning: package 'tibble' was built under R version 4.0.5
## Warning: package 'tidyr' was built under R version 4.0.5
## Warning: package 'readr' was built under R version 4.0.5
## Warning: package 'dplyr' was built under R version 4.0.5
## Warning: package 'forcats' was built under R version 4.0.5
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(ggpubr) #for making multipanel figures
## Warning: package 'ggpubr' was built under R version 4.0.5
library(sjPlot) #for saving figures as svg file types
## Learn more about sjPlot with 'browseVignettes("sjPlot")'.
field measurements Cloud compare measures of canopy size and volume.
field <- read.csv("shrub_field_volume.csv", header=TRUE)
CC <- read.csv("shrub_CC_volume.csv", header = TRUE)
#vol <- read.csv("CloudCompare_Volume_forR.csv", header=T)
#merge field and CC measurements by shrub id
vol <- left_join(field, CC, by = 'Shrub_ID')
vol = vol %>% drop_na()
Total number of shrubs samples Number per species Mean and range for height, canopy size and volume
summary(vol)
## Shrub_ID species_short_code species_full_code species_name
## Length:105 Length:105 Length:105 Length:105
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## species_common rep ht_cm d1_cm
## Length:105 Min. : 1.000 Min. : 19.0 Min. : 23.00
## Class :character 1st Qu.: 4.000 1st Qu.: 38.0 1st Qu.: 56.00
## Mode :character Median : 8.000 Median : 49.0 Median : 75.00
## Mean : 7.829 Mean : 57.1 Mean : 88.81
## 3rd Qu.:12.000 3rd Qu.: 68.0 3rd Qu.:112.00
## Max. :15.000 Max. :178.0 Max. :334.00
## d2_cm ht_m d1_m d2_m
## Min. : 15.0 Min. :0.190 Min. :0.2300 Min. :0.150
## 1st Qu.: 38.0 1st Qu.:0.380 1st Qu.:0.5600 1st Qu.:0.380
## Median : 55.0 Median :0.490 Median :0.7500 Median :0.550
## Mean : 69.9 Mean :0.571 Mean :0.8881 Mean :0.699
## 3rd Qu.: 83.0 3rd Qu.:0.680 3rd Qu.:1.1200 3rd Qu.:0.830
## Max. :255.0 Max. :1.780 Max. :3.3400 Max. :2.550
## field_volume_Andi_m3 field_volume_m3 mean_z min_z
## Min. :0.004948 Min. : 0.009896 Min. :1463 Min. :1463
## 1st Qu.:0.041584 1st Qu.: 0.083168 1st Qu.:1466 1st Qu.:1466
## Median :0.085281 Median : 0.170561 Median :1469 Median :1469
## Mean :0.418699 Mean : 0.837398 Mean :1469 Mean :1469
## 3rd Qu.:0.304734 3rd Qu.: 0.609469 3rd Qu.:1471 3rd Qu.:1471
## Max. :7.937894 Max. :15.875787 Max. :1475 Max. :1475
## CC_height_Z CC_D1_X CC_D2_Y vol_method1_XY
## Min. :0.1160 Min. :0.3350 Min. :0.318 Min. : 0.01513
## 1st Qu.:0.3219 1st Qu.:0.6620 1st Qu.:0.633 1st Qu.: 0.15255
## Median :0.4410 Median :0.8359 Median :0.804 Median : 0.29727
## Mean :0.5118 Mean :0.9522 Mean :0.958 Mean : 0.99338
## 3rd Qu.:0.5920 3rd Qu.:1.0620 3rd Qu.:1.079 3rd Qu.: 0.77999
## Max. :1.8080 Max. :3.5659 Max. :3.813 Max. :25.74303
## vol_method1_Andi CC_D1_longest CC_D2_perp vol_method2_longest
## Min. : 0.007568 Min. :0.3040 Min. :0.208 Min. : 0.009141
## 1st Qu.: 0.076277 1st Qu.:0.6660 1st Qu.:0.588 1st Qu.: 0.150221
## Median : 0.148634 Median :0.8529 Median :0.750 Median : 0.277976
## Mean : 0.496692 Mean :0.9972 Mean :0.857 Mean : 0.939220
## 3rd Qu.: 0.389992 3rd Qu.:1.1620 3rd Qu.:0.960 3rd Qu.: 0.710022
## Max. :12.871518 Max. :3.7469 Max. :3.398 Max. :24.105574
## vol_method2_Andi X2.5Vol_0.05_avg X2.5Vol_0.05_max X2.5Vol_0.025_avg
## Min. : 0.00457 Min. : 0.0090 Min. : 0.0110 Min. : 0.0080
## 1st Qu.: 0.07511 1st Qu.: 0.0930 1st Qu.: 0.1030 1st Qu.: 0.0870
## Median : 0.13899 Median : 0.1840 Median : 0.2000 Median : 0.1690
## Mean : 0.46961 Mean : 0.5962 Mean : 0.6475 Mean : 0.5551
## 3rd Qu.: 0.35501 3rd Qu.: 0.4160 3rd Qu.: 0.4510 3rd Qu.: 0.3860
## Max. :12.05279 Max. :13.8140 Max. :14.2800 Max. :12.8670
## X2.5Vol_0.025_max
## Min. : 0.0090
## 1st Qu.: 0.0890
## Median : 0.1720
## Mean : 0.5778
## 3rd Qu.: 0.4010
## Max. :13.0740
vol$species_short_code <-factor(vol$species_short_code)
descriptive_stats = vol %>%
group_by(species_short_code) %>%
summarize(count = n(),
mean_fieldHeight_m = mean(ht_m),
median_fieldHeight_m = median(ht_m),
min_fieldHeight_m = min(ht_m),
max_fieldHeight_m = max(ht_m),
mean_field_D1_m = mean(d1_m),
median_field_D1_m = median(d1_m),
min_field_D1_m = min(d1_m),
max_field_D1_m = max(d1_m),
mean_field_D2_m = mean(d2_m),
median_field_D2_m = median(d2_m),
min_field_D2_m = min(d2_m),
max_field_D2_m = max(d2_m),
mean_vol = mean(field_volume_m3),
min_vol = min(field_volume_m3),
max_vol = max(field_volume_m3)
)
#export descriptive stats
#only run this once!
#(descriptive_stats, "shrub_field_size_descriptiveStats2.csv", row.names = F)
histogram view
gg_hist<- ggplot(vol, aes(x=field_volume_m3)) +
geom_histogram(binwidth = 0.01)+
xlab(bquote('Field measured volume '(m^3)))+
ylab("Count - number of shrubs")+
scale_x_continuous(expand = c(0, 0)) +
scale_y_continuous(expand = c(0, 0))+
theme_classic()
gg_hist
summary(vol$field_volume_m3)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.009896 0.083168 0.170561 0.837398 0.609469 15.875787
#find two individual shrubs which were over 13 m^3 vol
dplyr::filter(vol, field_volume_m3 >14)
## Shrub_ID species_short_code species_full_code species_name
## 1 PUTR_14 PUTR PUTR2 Purshia tridentata
## 2 PUTR_9 PUTR PUTR2 Purshia tridentata
## species_common rep ht_cm d1_cm d2_cm ht_m d1_m d2_m
## 1 Antelope bitterbrush 14 178 334 255 1.78 3.34 2.55
## 2 Antelope bitterbrush 9 175 328 242 1.75 3.28 2.42
## field_volume_Andi_m3 field_volume_m3 mean_z min_z CC_height_Z CC_D1_X
## 1 7.937894 15.87579 1468.796 1468.617 1.807983 3.565918
## 2 7.273206 14.54641 1469.852 1469.557 1.488037 1.635986
## CC_D2_Y vol_method1_XY vol_method1_Andi CC_D1_longest CC_D2_perp
## 1 3.812988 25.743035 12.871518 3.746948 3.397949
## 2 3.210999 8.185818 4.092909 2.810974 2.562012
## vol_method2_longest vol_method2_Andi X2.5Vol_0.05_avg X2.5Vol_0.05_max
## 1 24.10557 12.05279 11.259 12.105
## 2 11.22226 5.61113 13.814 14.280
## X2.5Vol_0.025_avg X2.5Vol_0.025_max
## 1 10.437 10.877
## 2 12.867 13.074
PUTR_14 - field volume 15.87 PUTR_9 - field volume 14.54
create a subsetted dataset without the two giant shrubs: PUTR_9, PUTR_14
vol_nobig = vol %>% filter (!Shrub_ID == 'PUTR_9' &
!Shrub_ID == 'PUTR_14')
#just the CHVIs
head(vol)
## Shrub_ID species_short_code species_full_code species_name
## 1 ARAR_1 ARAR ARAR8 Artemisia arbuscula
## 2 ARAR_10 ARAR ARAR8 Artemisia arbuscula
## 3 ARAR_11 ARAR ARAR8 Artemisia arbuscula
## 4 ARAR_12 ARAR ARAR8 Artemisia arbuscula
## 5 ARAR_13 ARAR ARAR8 Artemisia arbuscula
## 6 ARAR_14 ARAR ARAR8 Artemisia arbuscula
## species_common rep ht_cm d1_cm d2_cm ht_m d1_m d2_m field_volume_Andi_m3
## 1 low sagebrush 1 50 58 21 0.50 0.58 0.21 0.03188717
## 2 low sagebrush 10 49 136 152 0.49 1.36 1.52 0.53036786
## 3 low sagebrush 11 24 52 30 0.24 0.52 0.30 0.01960354
## 4 low sagebrush 12 40 49 36 0.40 0.49 0.36 0.03694513
## 5 low sagebrush 13 43 61 48 0.43 0.61 0.48 0.06592318
## 6 low sagebrush 14 34 75 49 0.34 0.75 0.49 0.06542367
## field_volume_m3 mean_z min_z CC_height_Z CC_D1_X CC_D2_Y
## 1 0.06377433 1467.270 1467.251 0.357056 0.780029 0.620972
## 2 1.06073572 1469.192 1469.107 0.559082 1.219023 1.737023
## 3 0.03920708 1469.696 1469.652 0.205078 0.464966 0.509949
## 4 0.07389026 1468.343 1468.335 0.355957 0.562988 0.592957
## 5 0.13184636 1469.904 1469.867 0.358032 0.718994 0.643982
## 6 0.13084733 1467.564 1467.537 0.328979 0.713013 0.830017
## vol_method1_XY vol_method1_Andi CC_D1_longest CC_D2_perp vol_method2_longest
## 1 0.18111221 0.09055610 0.942993 0.772034 0.27221362
## 2 1.23971426 0.61985713 1.770020 0.301025 0.31194991
## 3 0.05092085 0.02546042 0.569946 0.489990 0.05997477
## 4 0.12443670 0.06221835 0.738037 0.705994 0.19422508
## 5 0.17359990 0.08679995 0.757996 0.588013 0.16711072
## 6 0.20388310 0.10194155 0.838989 0.765991 0.22139955
## vol_method2_Andi X2.5Vol_0.05_avg X2.5Vol_0.05_max X2.5Vol_0.025_avg
## 1 0.13610681 0.142 0.157 0.132
## 2 0.15597496 0.975 1.029 0.937
## 3 0.02998739 0.095 0.107 0.090
## 4 0.09711254 0.092 0.104 0.087
## 5 0.08355536 1.845 1.855 1.666
## 6 0.11069977 0.105 0.115 0.098
## X2.5Vol_0.025_max
## 1 0.137
## 2 0.952
## 3 0.094
## 4 0.091
## 5 1.668
## 6 0.101
vol_CHVI = vol_nobig %>% filter(species_short_code == 'CHVI')
vol_CHVI
## Shrub_ID species_short_code species_full_code species_name
## 1 CHVI_1 CHVI CHVI8 Chrysothamnus viscidiflorus
## 2 CHVI_10 CHVI CHVI8 Chrysothamnus viscidiflorus
## 3 CHVI_11 CHVI CHVI8 Chrysothamnus viscidiflorus
## 4 CHVI_12 CHVI CHVI8 Chrysothamnus viscidiflorus
## 5 CHVI_13 CHVI CHVI8 Chrysothamnus viscidiflorus
## 6 CHVI_14 CHVI CHVI8 Chrysothamnus viscidiflorus
## 7 CHVI_15 CHVI CHVI8 Chrysothamnus viscidiflorus
## 8 CHVI_2 CHVI CHVI8 Chrysothamnus viscidiflorus
## 9 CHVI_3 CHVI CHVI8 Chrysothamnus viscidiflorus
## 10 CHVI_4 CHVI CHVI8 Chrysothamnus viscidiflorus
## 11 CHVI_5 CHVI CHVI8 Chrysothamnus viscidiflorus
## 12 CHVI_6 CHVI CHVI8 Chrysothamnus viscidiflorus
## 13 CHVI_7 CHVI CHVI8 Chrysothamnus viscidiflorus
## 14 CHVI_9 CHVI CHVI8 Chrysothamnus viscidiflorus
## species_common rep ht_cm d1_cm d2_cm ht_m d1_m d2_m field_volume_Andi_m3
## 1 yellow rabbitbrush 1 41 55 30 0.41 0.55 0.30 0.035421457
## 2 yellow rabbitbrush 10 32 45 45 0.32 0.45 0.45 0.033929201
## 3 yellow rabbitbrush 11 19 43 35 0.19 0.43 0.35 0.014972307
## 4 yellow rabbitbrush 12 49 61 42 0.49 0.61 0.42 0.065731543
## 5 yellow rabbitbrush 13 42 57 35 0.42 0.57 0.35 0.043872341
## 6 yellow rabbitbrush 14 43 41 35 0.43 0.41 0.35 0.032308662
## 7 yellow rabbitbrush 15 44 65 41 0.44 0.65 0.41 0.061397192
## 8 yellow rabbitbrush 2 31 48 28 0.31 0.48 0.28 0.021815219
## 9 yellow rabbitbrush 3 37 67 55 0.37 0.67 0.55 0.071390075
## 10 yellow rabbitbrush 4 21 30 15 0.21 0.30 0.15 0.004948008
## 11 yellow rabbitbrush 5 43 62 34 0.43 0.62 0.34 0.047461087
## 12 yellow rabbitbrush 6 20 24 25 0.20 0.24 0.25 0.006283185
## 13 yellow rabbitbrush 7 44 69 41 0.44 0.69 0.41 0.065175481
## 14 yellow rabbitbrush 9 35 35 20 0.35 0.35 0.20 0.012828170
## field_volume_m3 mean_z min_z CC_height_Z CC_D1_X CC_D2_Y
## 1 0.070842914 1468.927 1468.885 0.298044 0.630005 0.614990
## 2 0.067858401 1469.676 1469.657 0.241089 0.535034 0.563965
## 3 0.029944614 1470.644 1470.677 0.213013 0.495972 0.572021
## 4 0.131463086 1471.517 1471.485 0.369995 0.554016 0.476013
## 5 0.087744683 1470.295 1470.266 0.310913 0.760986 0.489014
## 6 0.064617325 1471.023 1470.989 0.284058 0.588013 0.567017
## 7 0.122794385 1470.298 1470.246 0.375977 0.641968 0.702026
## 8 0.043630439 1469.331 1469.315 0.239014 0.582031 0.537048
## 9 0.142780150 1470.388 1470.370 0.178101 0.562012 0.423950
## 10 0.009896017 1470.183 1470.163 0.328003 0.756958 0.778992
## 11 0.094922175 1470.409 1470.359 0.307007 0.681030 0.750000
## 12 0.012566371 1469.967 1469.933 0.115967 0.335022 0.372009
## 13 0.130350962 1467.626 1467.564 0.422974 0.816895 0.701965
## 14 0.025656340 1466.331 1466.322 0.281006 0.612061 0.601990
## vol_method1_XY vol_method1_Andi CC_D1_longest CC_D2_perp vol_method2_longest
## 1 0.12092638 0.060463190 0.586975 0.556030 0.10186543
## 2 0.07617975 0.038089875 0.548096 0.487061 0.06739784
## 3 0.06328545 0.031642724 0.572021 0.558960 0.07132264
## 4 0.10217993 0.051089964 0.643005 0.602966 0.15022135
## 5 0.12116173 0.060580864 0.897949 0.581970 0.17014523
## 6 0.09917875 0.049589377 0.615112 0.497986 0.09111859
## 7 0.17744202 0.088721010 0.817017 0.750000 0.24125829
## 8 0.07823682 0.039118409 0.587036 0.600952 0.08829914
## 9 0.04443807 0.022219036 0.459961 0.346008 0.02968261
## 10 0.20254019 0.101270095 0.739990 0.717041 0.18225367
## 11 0.16421182 0.082105908 0.740967 0.747925 0.17816968
## 12 0.01513526 0.007567629 0.428955 0.421021 0.02193201
## 13 0.25399431 0.126997155 0.812012 0.676025 0.24314620
## 14 0.10842469 0.054212346 0.606995 0.553955 0.09894727
## vol_method2_Andi X2.5Vol_0.05_avg X2.5Vol_0.05_max X2.5Vol_0.025_avg
## 1 0.05093272 0.057 0.066 0.053
## 2 0.03369892 0.055 0.061 0.050
## 3 0.03566132 0.056 0.062 0.050
## 4 0.07511067 0.075 0.087 0.070
## 5 0.08507261 0.093 0.105 0.087
## 6 0.04555929 0.062 0.069 0.058
## 7 0.12062915 0.281 0.294 0.253
## 8 0.04414957 0.059 0.065 0.054
## 9 0.01484131 0.025 0.028 0.022
## 10 0.09112683 0.185 0.197 0.169
## 11 0.08908484 0.086 0.095 0.080
## 12 0.01096601 0.009 0.011 0.008
## 13 0.12157310 0.153 0.170 0.141
## 14 0.04947363 0.037 0.044 0.035
## X2.5Vol_0.025_max
## 1 0.055
## 2 0.052
## 3 0.052
## 4 0.073
## 5 0.090
## 6 0.060
## 7 0.256
## 8 0.056
## 9 0.023
## 10 0.172
## 11 0.083
## 12 0.009
## 13 0.146
## 14 0.036
summary(vol_nobig$field_volume_m3 )
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.009896 0.082975 0.167719 0.558297 0.547596 5.266472
vol_super_small<- filter(vol_nobig, field_volume_m3 < 0.05)
vol_no_super_small <- filter(vol_nobig, field_volume_m3 > 0.05)
skinny = dplyr::filter(vol_nobig, d2_m < 1)
add two different mean lines onto the histogram - one with and one without the biggies
#get means with and without biggies
mean_vol_all = mean(vol$field_volume_m3)
mean_vol_smallies = mean(vol_nobig$field_volume_m3)
#add to plot
gg_hist<- ggplot(vol, aes(x=field_volume_m3)) +
geom_histogram(binwidth = 3)+
xlab(bquote('Field measured volume '(m^3)))+
ylab("Count - number of shrubs")+
scale_x_continuous(expand = c(0, 0)) +
scale_y_continuous(expand = c(0, 0))+
theme_classic()+
geom_vline(xintercept = mean_vol_all,
color = "cyan4", size=1.5)+
geom_vline(xintercept = mean_vol_smallies,
color = "darkgoldenrod2", size=1.5)
gg_hist
recalculate summary stats without biggies
summary(vol)
## Shrub_ID species_short_code species_full_code species_name
## Length:105 ARAR :15 Length:105 Length:105
## Class :character ARTRV :15 Class :character Class :character
## Mode :character ERNA :15 Mode :character Mode :character
## PUTR :15
## TECA :15
## ARTRW :14
## (Other):16
## species_common rep ht_cm d1_cm
## Length:105 Min. : 1.000 Min. : 19.0 Min. : 23.00
## Class :character 1st Qu.: 4.000 1st Qu.: 38.0 1st Qu.: 56.00
## Mode :character Median : 8.000 Median : 49.0 Median : 75.00
## Mean : 7.829 Mean : 57.1 Mean : 88.81
## 3rd Qu.:12.000 3rd Qu.: 68.0 3rd Qu.:112.00
## Max. :15.000 Max. :178.0 Max. :334.00
##
## d2_cm ht_m d1_m d2_m
## Min. : 15.0 Min. :0.190 Min. :0.2300 Min. :0.150
## 1st Qu.: 38.0 1st Qu.:0.380 1st Qu.:0.5600 1st Qu.:0.380
## Median : 55.0 Median :0.490 Median :0.7500 Median :0.550
## Mean : 69.9 Mean :0.571 Mean :0.8881 Mean :0.699
## 3rd Qu.: 83.0 3rd Qu.:0.680 3rd Qu.:1.1200 3rd Qu.:0.830
## Max. :255.0 Max. :1.780 Max. :3.3400 Max. :2.550
##
## field_volume_Andi_m3 field_volume_m3 mean_z min_z
## Min. :0.004948 Min. : 0.009896 Min. :1463 Min. :1463
## 1st Qu.:0.041584 1st Qu.: 0.083168 1st Qu.:1466 1st Qu.:1466
## Median :0.085281 Median : 0.170561 Median :1469 Median :1469
## Mean :0.418699 Mean : 0.837398 Mean :1469 Mean :1469
## 3rd Qu.:0.304734 3rd Qu.: 0.609469 3rd Qu.:1471 3rd Qu.:1471
## Max. :7.937894 Max. :15.875787 Max. :1475 Max. :1475
##
## CC_height_Z CC_D1_X CC_D2_Y vol_method1_XY
## Min. :0.1160 Min. :0.3350 Min. :0.318 Min. : 0.01513
## 1st Qu.:0.3219 1st Qu.:0.6620 1st Qu.:0.633 1st Qu.: 0.15255
## Median :0.4410 Median :0.8359 Median :0.804 Median : 0.29727
## Mean :0.5118 Mean :0.9522 Mean :0.958 Mean : 0.99338
## 3rd Qu.:0.5920 3rd Qu.:1.0620 3rd Qu.:1.079 3rd Qu.: 0.77999
## Max. :1.8080 Max. :3.5659 Max. :3.813 Max. :25.74303
##
## vol_method1_Andi CC_D1_longest CC_D2_perp vol_method2_longest
## Min. : 0.007568 Min. :0.3040 Min. :0.208 Min. : 0.009141
## 1st Qu.: 0.076277 1st Qu.:0.6660 1st Qu.:0.588 1st Qu.: 0.150221
## Median : 0.148634 Median :0.8529 Median :0.750 Median : 0.277976
## Mean : 0.496692 Mean :0.9972 Mean :0.857 Mean : 0.939220
## 3rd Qu.: 0.389992 3rd Qu.:1.1620 3rd Qu.:0.960 3rd Qu.: 0.710022
## Max. :12.871518 Max. :3.7469 Max. :3.398 Max. :24.105574
##
## vol_method2_Andi X2.5Vol_0.05_avg X2.5Vol_0.05_max X2.5Vol_0.025_avg
## Min. : 0.00457 Min. : 0.0090 Min. : 0.0110 Min. : 0.0080
## 1st Qu.: 0.07511 1st Qu.: 0.0930 1st Qu.: 0.1030 1st Qu.: 0.0870
## Median : 0.13899 Median : 0.1840 Median : 0.2000 Median : 0.1690
## Mean : 0.46961 Mean : 0.5962 Mean : 0.6475 Mean : 0.5551
## 3rd Qu.: 0.35501 3rd Qu.: 0.4160 3rd Qu.: 0.4510 3rd Qu.: 0.3860
## Max. :12.05279 Max. :13.8140 Max. :14.2800 Max. :12.8670
##
## X2.5Vol_0.025_max
## Min. : 0.0090
## 1st Qu.: 0.0890
## Median : 0.1720
## Mean : 0.5778
## 3rd Qu.: 0.4010
## Max. :13.0740
##
vol_nobig$species_short_code <-factor(vol_nobig$species_short_code)
descriptive_stats_noBig = vol_nobig %>%
group_by(species_short_code) %>%
summarize(count = n(),
mean_fieldHeight_m = mean(ht_m),
median_fieldHeight_m = median(ht_m),
min_fieldHeight_m = min(ht_m),
max_fieldHeight_m = max(ht_m),
mean_field_D1_m = mean(d1_m),
median_field_D1_m = median(d1_m),
min_field_D1_m = min(d1_m),
max_field_D1_m = max(d1_m),
mean_field_D2_m = mean(d2_m),
median_field_D2_m = median(d2_m),
min_field_D2_m = min(d2_m),
max_field_D2_m = max(d2_m),
mean_vol = mean(field_volume_m3),
min_vol = min(field_volume_m3),
max_vol = max(field_volume_m3)
)
Compare volume measurement techniques
theme_set(
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.text = element_text(size=11, colour = "black"),
axis.line = element_line(colour = "black"), axis.title = element_text(size=16, colour = "black"),
legend.title = element_text(size = 16, colour = "black"), legend.text = element_text(size=16, colour= "black")))
gg_vol1 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "a. 2.5D: avg, 5 cm cells")+ylim(0,3)+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol2 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.05_max)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "b. 2.5D: max, 5 cm cells", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) + ylim(0,3)+
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#geom_smooth(method=lm)+
gg_vol4 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.025_avg)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "c. 2.5D: avg, 2.5 cm cells")+ylim(0,3)+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#geom_smooth(method=lm)+
gg_vol3 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.025_max)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "d. 2.5D: max, 2.5 cm cells")+ylim(0,3)+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#geom_smooth(method=lm)+
#summary(vol_nobig$vol_method1_XY)
gg_vol5 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = vol_method1_XY)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "e. CC-snap method")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
ylim(0,8)+
stat_regline_equation(label.y = 7.5, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 6, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#geom_smooth(method=lm)+
#summary(vol_nobig$vol_method2_longest)
gg_vol6 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = vol_method2_longest)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "f. Top-down method")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
ylim(0,6)+
stat_regline_equation(label.y = 5.5, aes(label = ..eq.label..), size = 3.5) +
stat_regline_equation(label.y = 4.5, aes(label = ..rr.label..), size = 3.5)+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#geom_smooth(method=lm)+
#combine into one plot
vol_figure <- ggarrange(
gg_vol1 + theme(axis.title.x = element_blank()),
gg_vol2 + theme(axis.title=element_blank()),
gg_vol4 + theme(axis.title.x = element_blank()),
gg_vol3 + theme(axis.title=element_blank()),
gg_vol5,
gg_vol6 +theme(axis.title.y=element_blank()),
ncol = 2, nrow = 3)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
vol_figure
#save plots
#as jpeg
#ggsave("Figures and Tables for manuscript/vol_comparison.jpeg", plot = vol_figure, device = "jpeg", width = 6, height = 8, dpi = 300, scale = 1)
#as svg
#save_plot("Figures and Tables for manuscript/vol_plot.svg", fig = vol_figure, width = 12, height = 16)
gg_height2 <- ggplot(vol_nobig, aes(x=ht_m, y = CC_height_Z)) +
geom_point(size = 2.5)+
labs(x = "Field measured height (M)", y = "CloundCompare height (M)",
title = "Shrub Height")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 1.35, aes(label = ..eq.label..), size = 5) +
stat_regline_equation(label.y = 1.25, aes(label = ..rr.label..), size = 5)+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_height2
## `geom_smooth()` using formula 'y ~ x'
#save figure
#as jpeg
ggsave("Figures and Tables for manuscript/height.jpeg", plot = gg_height2, device = "jpeg",
width = 4, height = 4, dpi = 300, scale = 1)
## `geom_smooth()` using formula 'y ~ x'
#as svg
save_plot("Figures and Tables for manuscript/height.svg", fig = gg_height2, width = 3, height = 4)
## `geom_smooth()` using formula 'y ~ x'
## png
## 2
shorties <- filter(vol, ht_m < 1.5)
gg_height_shorties <- ggplot(shorties, aes(x=ht_m, y = CC_height_Z)) +
geom_point(size = 2.5)+
labs(x = "Field measured height (M)", y = "CloundCompare height (M)",
title = "Shrub Height")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 1.35, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 1.25, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_height_shorties
## `geom_smooth()` using formula 'y ~ x'
gg_width1 <- ggplot(vol_nobig, aes(x=d1_m, y = CC_D1_X)) +
geom_point(size = 2.5)+
labs(x = "Field width (m)", y = "CC width (m)",
title="a. D1 - CC-snap method")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..), size=4)+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width2 <- ggplot(vol_nobig, aes(x=d2_m, y = CC_D2_Y)) +
geom_point(size = 2.5)+
labs(x = "Field width (m)", y = "CC width (m)",
title="c. D2 - CC-snap method", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..), size=4)+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width3 <- ggplot(vol_nobig, aes(x=d1_m, y = CC_D1_longest)) +
geom_point(size = 2.5)+
labs(x = "Field width (m)", y = "CC width (m)",
title="b. D1 - Top-down method", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..), size=4)+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width4 <- ggplot(vol_nobig, aes(x=d2_m, y = CC_D2_perp)) +
geom_point(size = 2.5)+
labs(x = "Field width (m)", y = "CC width (m)",
title="d. D2 - Top-down method", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..), size=4)+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
width_figure2 <-
ggarrange(gg_width1+ theme(axis.title.x = element_blank()),
gg_width3 + theme(axis.title=element_blank()),
gg_width2,
gg_width4 +theme(axis.title.y=element_blank()),
ncol = 2, nrow = 2)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
width_figure2
ggsave("Figures and Tables for manuscript/widths.jpeg", plot = width_figure2, device = "jpeg",
width = 4, height = 3, dpi = 300, scale = 1)
#
# data = vol_nobig
# ht_try = lm(CC_height_Z ~ ht_m, data = vol_nobig)
# summary(ht_try)
#
# #slope
# coefs <- ht_try$coefficients[2]
# coefs
# slope <- coef[2]
# r2<- summary(ht_try)$r.squared
#
#
#
#
# species_list = unique(vol_nobig$species_short_code)
#
# ARTRV = vol_nobig %>% filter(species_short_code =="ARTRV")
# sp_try = lm(CC_height_Z ~ ht_m, data = species_data)
# summary(sp_try)
#
#
# #slope
# coefs <- sp_try$coefficients
# slope <- coef[2]
# r2<- summary(sp_try)$r.squared
#
# #create output data table
# regression_output = data.frame(species = species_list)
# regression_output$r2 = rep(NA,8)
# regression_output$m = rep(NA,8)
#
# species_list_string = c("ARAR","ARTRT", "ARTRV", "ARTRW", "CHVI", "ERNA", "PUTR", "TECA")
# species_list_string[2]
#
# #create list of different data subset
#
# ARAR_data = vol_nobig %>%
# filter(species_short_code == "ARAR")
# ARTRV_data = vol_nobig %>%
# filter(species_short_code == "ARTRV")
#
# datasets = c(ARAR_data, ARTRV_data)
#
#
#
#
# for (species_name in species_list_string){
# print(species_name)
# #subset the data by species
# species_data = filter(vol_nobig, species_short_code == species_name)
# }
#
#
#
# for (species_name in species_list_string){
# #create linear regression
# linear_reg = lm(CC_height_Z ~ ht_m, data = ARTRV_data)
# #extract slope and r2
# slope <- linear_reg$coefficients[2]
# r2<- summary(ht_try)$r.squared
# #output slope and r2
# regression_output[species_name, r2] <- r2
# regression_output[species_name, m] <- slope
# }
#
#
#
#
# species_name = "ARTRV"
# species_data = filter(vol_nobig, species_short_code == "ARTRV")
#
# linear_reg = lm(CC_height_Z ~ ht_m, data = species_data)
# #extract slope and r2
# slope <- linear_reg$coefficients[2]
# r2<- summary(linear_reg)$r.squared
# #output slope and r2
# regression_output[regression_output$species_name=="ARTRV", ] <- r2
# regression_output
# regression_output[species_name, m] <- slope
# }
#
#
# #create output data table
# regression_output = data.frame(species = species_list)
# regression_output$r2 = rep(NA,8)
# regression_output$m = rep(NA,8)
#
#
#
# #create output dataset
# reg_output=t(data.frame(
# method = t(my_input_list)))
# summary(reg_output)
#
# reg_output$method = reg_output$V1
# reg_output$method = t(my_input_list)
#
# reg_output$m = rep(NA,11)
# reg_output$r2 = rep(NA,8)
# reg_output$species = rep(NA,8)
#
#
#
# ###### build the output data frame for one species
# methods = list("25_max","5_max", "25_avg", "5_avg", "vol_ccsnap", "vol_topdown",
# "height",
# "d1_snap", "d2_snap",
# "d1_topdown", "d2_topdown")
#
# reg_output_one_sp <- data.frame(unlist(methods))
# names(reg_output_one_sp) <-"Reg_method"
# reg_output_one_sp$m = rep(NA,11)
# reg_output_one_sp$r2 = rep(NA,11)
# ######
#
#
# ############
# #define the dataset
# data = ARTRV_data
#
#
# #run through all the regressions
# #2.5D Volume
# lm25_max = lm(X2.5Vol_0.025_max~field_volume_m3, data = data)
# reg_output_one_sp
#
# print(reg_output_one_sp$m[, reg_output_one_sp$Reg_method == "25_max"] )
#
#
# <- lm25_max$coefficients[2]
# reg_output_one_sp$r2 <- summary(lm25_max)$r.squared
# head(reg_output_one_sp)
#
#
# lm5_max = lm(X2.5Vol_0.05_max~field_volume_m3, data = data)
#
#
# #CC-Volume
#
# #height
#
# #widths
#
#
#
#
# gg_height2 <- ggplot(vol_nobig, aes(x=ht_m, y = CC_height_Z)) +
# geom_point(size = 2.5)+
# facet_grid(~species_short_code)+
# labs(x = "Field measured height (M)", y = "CloundCompare height (M)",
# title = "Shrub Height")+
# scale_color_brewer(palette="Dark2")+theme_classic()+
# geom_smooth(method = "lm", se=FALSE) +
# stat_regline_equation(label.y = 1.35, aes(label = ..eq.label..)) +
# stat_regline_equation(label.y = 1.25, aes(label = ..rr.label..))+
# geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
# gg_height2
exploratory figure without the giant shrubs
gg_vol1 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.05_avg,
color=species_short_code)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "5 cm grid cells - avg", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
gg_vol2 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.05_max,
color=species_short_code)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "5 cm grid cells - max", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
gg_vol4 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.025_avg,
color=species_short_code)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "2.5 cm grid cells - avg", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
gg_vol3 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.025_max,
color=species_short_code)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "2.5 cm grid cells - max", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
library(ggpubr)
vol_figure <- ggarrange(gg_vol1, gg_vol2, gg_vol4, gg_vol3,
ncol = 2, nrow = 2)
vol_figure
without species color coding, adding equation and lines of best fit
gg_vol_new <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.025_max)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "2.5 cm grid cells - max")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.2, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.1, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol_new
## `geom_smooth()` using formula 'y ~ x'
interpretation: 5 cm max seemed like it did the best in terms of r2 and slope.
try a faceted figure by species
gg_vol3 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.05_max,
color=species_short_code)) +
facet_wrap(~species_short_code)+
geom_point()+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "5 cm grid cells - max", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(legend.position = "none")+
geom_smooth(method=lm)+
ylim(0,3)+
stat_regline_equation(label.y = 2.9, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol3
## `geom_smooth()` using formula 'y ~ x'
## Warning in qt((1 - level)/2, df): NaNs produced
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
figure with only the main three woody species
vol_nobig_mainSp <- vol_nobig %>%
filter(species_short_code == 'ARTRW' |
species_short_code == 'PUTR' |
species_short_code == 'ARTRV')
gg_vol3 <- ggplot(vol_nobig_mainSp, aes(x=field_volume_m3, y = X2.5Vol_0.05_max,
color=species_short_code)) +
facet_wrap(~species_short_code)+
geom_point()+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "5 cm grid cells - max", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(legend.position = "none")+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.7, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol3
## `geom_smooth()` using formula 'y ~ x'
try that with only the small species
vol_smallies <- vol %>%
filter(species_short_code == 'ARAR' | species_short_code == 'TECA' |
species_short_code == 'ERNA' | species_short_code == 'CHVI')
gg_vol3 <- ggplot(vol_smallies, aes(x=field_volume_m3, y = X2.5Vol_0.05_max,
color=species_short_code)) +
facet_wrap(~species_short_code)+
geom_point()+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "5 cm grid cells - max", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(legend.position = "none")+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol3
## `geom_smooth()` using formula 'y ~ x'
including the big boys
head(vol)
## Shrub_ID species_short_code species_full_code species_name
## 1 ARAR_1 ARAR ARAR8 Artemisia arbuscula
## 2 ARAR_10 ARAR ARAR8 Artemisia arbuscula
## 3 ARAR_11 ARAR ARAR8 Artemisia arbuscula
## 4 ARAR_12 ARAR ARAR8 Artemisia arbuscula
## 5 ARAR_13 ARAR ARAR8 Artemisia arbuscula
## 6 ARAR_14 ARAR ARAR8 Artemisia arbuscula
## species_common rep ht_cm d1_cm d2_cm ht_m d1_m d2_m field_volume_Andi_m3
## 1 low sagebrush 1 50 58 21 0.50 0.58 0.21 0.03188717
## 2 low sagebrush 10 49 136 152 0.49 1.36 1.52 0.53036786
## 3 low sagebrush 11 24 52 30 0.24 0.52 0.30 0.01960354
## 4 low sagebrush 12 40 49 36 0.40 0.49 0.36 0.03694513
## 5 low sagebrush 13 43 61 48 0.43 0.61 0.48 0.06592318
## 6 low sagebrush 14 34 75 49 0.34 0.75 0.49 0.06542367
## field_volume_m3 mean_z min_z CC_height_Z CC_D1_X CC_D2_Y
## 1 0.06377433 1467.270 1467.251 0.357056 0.780029 0.620972
## 2 1.06073572 1469.192 1469.107 0.559082 1.219023 1.737023
## 3 0.03920708 1469.696 1469.652 0.205078 0.464966 0.509949
## 4 0.07389026 1468.343 1468.335 0.355957 0.562988 0.592957
## 5 0.13184636 1469.904 1469.867 0.358032 0.718994 0.643982
## 6 0.13084733 1467.564 1467.537 0.328979 0.713013 0.830017
## vol_method1_XY vol_method1_Andi CC_D1_longest CC_D2_perp vol_method2_longest
## 1 0.18111221 0.09055610 0.942993 0.772034 0.27221362
## 2 1.23971426 0.61985713 1.770020 0.301025 0.31194991
## 3 0.05092085 0.02546042 0.569946 0.489990 0.05997477
## 4 0.12443670 0.06221835 0.738037 0.705994 0.19422508
## 5 0.17359990 0.08679995 0.757996 0.588013 0.16711072
## 6 0.20388310 0.10194155 0.838989 0.765991 0.22139955
## vol_method2_Andi X2.5Vol_0.05_avg X2.5Vol_0.05_max X2.5Vol_0.025_avg
## 1 0.13610681 0.142 0.157 0.132
## 2 0.15597496 0.975 1.029 0.937
## 3 0.02998739 0.095 0.107 0.090
## 4 0.09711254 0.092 0.104 0.087
## 5 0.08355536 1.845 1.855 1.666
## 6 0.11069977 0.105 0.115 0.098
## X2.5Vol_0.025_max
## 1 0.137
## 2 0.952
## 3 0.094
## 4 0.091
## 5 1.668
## 6 0.101
gg_vol1 <- ggplot(vol, aes(x=field_volume_m3, y = vol_method1_XY,
color=species_short_code)) +
geom_point(size = 2.5)+
xlim(0,16)+ylim(0,15)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
gg_vol1
## Warning: Removed 1 rows containing missing values (geom_point).
gg_vol2 <- ggplot(vol, aes(x=field_volume_m3, y = vol_method2_longest,
color=species_short_code)) +
geom_point(size = 2.5)+
xlim(0,16)+ylim(0,15)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)
gg_vol2
## Warning: Removed 1 rows containing missing values (geom_point).
without the big shrubs
gg_vol1 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = vol_method1_XY,
color=species_short_code)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
gg_vol1
gg_vol2 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = vol_method2_longest,
color=species_short_code)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)
gg_vol2
vol_cc_method <- ggarrange(gg_vol1, gg_vol2, ncol=1, nrow=2)
vol_cc_method
add general trend lines without the big shrubs
gg_vol1 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = vol_method1_XY)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 4.7, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 4, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol1
## `geom_smooth()` using formula 'y ~ x'
gg_vol2 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = vol_method2_longest)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 4.7, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 4, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol2
## `geom_smooth()` using formula 'y ~ x'
vol_cc_method <- ggarrange(gg_vol1, gg_vol2, ncol=1, nrow=2)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
vol_cc_method
seems like method 1 is better
facet grid by all species
gg_vol1 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = vol_method1_XY, color=species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 6.5, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol1
## `geom_smooth()` using formula 'y ~ x'
## Warning in qt((1 - level)/2, df): NaNs produced
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
facet grid by all species
gg_vol2 <- ggplot(vol_nobig, aes(x=field_volume_m3, y = vol_method2_longest, color=species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 6, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 4.5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol2
## `geom_smooth()` using formula 'y ~ x'
## Warning in qt((1 - level)/2, df): NaNs produced
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
big species only
gg_vol1 <- ggplot(vol_nobig_mainSp, aes(x=field_volume_m3, y = vol_method1_XY,
color=species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 6.5, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol1
## `geom_smooth()` using formula 'y ~ x'
gg_vol2 <- ggplot(vol_nobig_mainSp, aes(x=field_volume_m3, y = vol_method2_longest,
color=species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 6, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 4.5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol2
## `geom_smooth()` using formula 'y ~ x'
small shrubs only
gg_vol1 <- ggplot(vol_smallies, aes(x=field_volume_m3, y = vol_method1_XY,
color=species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 6.5, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol1
## `geom_smooth()` using formula 'y ~ x'
gg_vol2 <- ggplot(vol_smallies, aes(x=field_volume_m3, y = vol_method2_longest,
color=species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('2.5 D Volume '(m^3)))+
labs(title = "Volume from CC height and canopy width - Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 6, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 4.5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol2
## `geom_smooth()` using formula 'y ~ x'
facet height by species
gg_height3 <- ggplot(vol_nobig, aes(x=ht_m, y = CC_height_Z)) +
facet_wrap(~species_short_code)+
geom_point()+
labs(x = "Field measured height (M)", y = "CloundCompare height (M)",
title = "Shrub Height")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 1.35, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 1.15, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_height3
## `geom_smooth()` using formula 'y ~ x'
## Warning in qt((1 - level)/2, df): NaNs produced
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
gg_height4 <- ggplot(vol_nobig_mainSp, aes(x=ht_m, y = CC_height_Z, color = species_short_code)) +
facet_wrap(~species_short_code)+
geom_point()+
labs(x = "Field measured height (M)", y = "CloundCompare height (M)",
title = "Shrub Height")+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(legend.position = "none")+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 1.35, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 1.15, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_height4
## `geom_smooth()` using formula 'y ~ x'
gg_height5 <- ggplot(vol_smallies, aes(x=ht_m, y = CC_height_Z, color = species_short_code)) +
facet_wrap(~species_short_code)+
geom_point()+
labs(x = "Field measured height (M)", y = "CloundCompare height (M)",
title = "Shrub Height")+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(legend.position = "none")+
geom_smooth(method=lm)+
stat_regline_equation(label.y = 1.35, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 1.15, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_height5
## `geom_smooth()` using formula 'y ~ x'
gg_width1 <- ggplot(vol, aes(x=d1_m, y = CC_D1_X,
color=species_short_code)) +
geom_point(size = 2.5)+
labs(x = "Field measured width (m)", y = "CloudCompare width 1 (m)",
title="D1 - CC Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
gg_width1
gg_width2 <- ggplot(vol, aes(x=d2_m, y = CC_D2_Y,
color=species_short_code)) +
geom_point(size = 2.5)+
labs(x = "Field measured width (m)", y = "CloudCompare width 1 (m)",
title="D2 - CC Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
gg_width2
gg_width3 <- ggplot(vol, aes(x=d1_m, y = CC_D1_longest,
color=species_short_code)) +
geom_point(size = 2.5)+
labs(x = "Field measured width (m)", y = "CloudCompare width 1 (m)",
title="D1 - CC Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
gg_width3
gg_width4 <- ggplot(vol, aes(x=d2_m, y = CC_D2_perp,
color=species_short_code)) +
geom_point(size = 2.5)+
labs(x = "Field measured width (m)", y = "CloudCompare width 1 (m)",
title="D2 - CC Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()
#geom_smooth(method=lm)+
gg_width4
width_figure1 <- ggarrange(gg_width1, gg_width2, gg_width3, gg_width4,
ncol = 2, nrow = 2)
width_figure1
Faceted figure by all species for d1 and d2
gg_width3 <- ggplot(vol, aes(x=d1_m, y = CC_D1_X, color = species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
labs(x = "Field measured width (m)", y = "CloudCompare width (m)",
title="D1 - CloudCompare Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width3
## `geom_smooth()` using formula 'y ~ x'
## Warning in qt((1 - level)/2, df): NaNs produced
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
gg_width3 <- ggplot(vol, aes(x=d1_m, y = CC_D1_longest, color = species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
labs(x = "Field measured width (m)", y = "CloudCompare width (m)",
title="D1 - CloudCompare Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width3
## `geom_smooth()` using formula 'y ~ x'
## Warning in qt((1 - level)/2, df): NaNs produced
## Warning in qt((1 - level)/2, df): no non-missing arguments to max; returning
## -Inf
gg_width4 <- ggplot(vol, aes(x=d2_m, y = CC_D2_Y, color = species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
labs(x = "Field measured width (m)", y = "CloudCompare width (m)",
title="D2 - CloudCompare Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width4
## `geom_smooth()` using formula 'y ~ x'
## Warning in qt((1 - level)/2, df): NaNs produced
## Warning in qt((1 - level)/2, df): no non-missing arguments to max; returning
## -Inf
gg_width4 <- ggplot(vol, aes(x=d2_m, y = CC_D2_perp, color = species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
labs(x = "Field measured width (m)", y = "CloudCompare width (m)",
title="D2 - CloudCompare Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width4
## `geom_smooth()` using formula 'y ~ x'
## Warning in qt((1 - level)/2, df): NaNs produced
## Warning in qt((1 - level)/2, df): no non-missing arguments to max; returning
## -Inf
faceted figure for just main woody species
gg_width3 <- ggplot(vol_nobig_mainSp, aes(x=d1_m, y = CC_D1_X, color = species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
labs(x = "Field measured width (m)", y = "CloudCompare width (m)",
title="D1 - CloudCompare Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width3
## `geom_smooth()` using formula 'y ~ x'
gg_width3 <- ggplot(vol_nobig_mainSp, aes(x=d1_m, y = CC_D1_longest, color = species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
labs(x = "Field measured width (m)", y = "CloudCompare width (m)",
title="D1 - CloudCompare Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 3, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.6, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width3
## `geom_smooth()` using formula 'y ~ x'
faceted figure for small guys faceted figure for just main woody species
gg_width4 <- ggplot(vol_smallies, aes(x=d1_m, y = CC_D1_X,
color = species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
labs(x = "Field measured width (m)", y = "CloudCompare width (m)",
title="D1 - CloudCompare Method 1", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 2.9, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width4
## `geom_smooth()` using formula 'y ~ x'
gg_width4 <- ggplot(vol_smallies, aes(x=d1_m, y = CC_D1_longest,
color = species_short_code)) +
geom_point(size = 2.5)+
facet_wrap(~species_short_code)+
labs(x = "Field measured width (m)", y = "CloudCompare width (m)",
title="D1 - CloudCompare Method 2", color = "Species")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method=lm)+
theme(legend.position = "none")+
stat_regline_equation(label.y = 2.9, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 2.5, aes(label = ..rr.label..))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_width4
## `geom_smooth()` using formula 'y ~ x'