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_group
## 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_name species_common rep ht_cm
## Length:105 Length:105 Min. : 1.000 Min. : 19.0
## Class :character Class :character 1st Qu.: 4.000 1st Qu.: 38.0
## Mode :character Mode :character Median : 8.000 Median : 49.0
## Mean : 7.829 Mean : 57.1
## 3rd Qu.:12.000 3rd Qu.: 68.0
## Max. :15.000 Max. :178.0
## d1_cm d2_cm ht_m d1_m
## Min. : 23.00 Min. : 15.0 Min. :0.190 Min. :0.2300
## 1st Qu.: 56.00 1st Qu.: 38.0 1st Qu.:0.380 1st Qu.:0.5600
## Median : 75.00 Median : 55.0 Median :0.490 Median :0.7500
## Mean : 88.81 Mean : 69.9 Mean :0.571 Mean :0.8881
## 3rd Qu.:112.00 3rd Qu.: 83.0 3rd Qu.:0.680 3rd Qu.:1.1200
## Max. :334.00 Max. :255.0 Max. :1.780 Max. :3.3400
## d2_m field_volume_Andi_m3 field_volume_m3 mean_z
## Min. :0.150 Min. :0.004948 Min. : 0.009896 Min. :1463
## 1st Qu.:0.380 1st Qu.:0.041584 1st Qu.: 0.083168 1st Qu.:1466
## Median :0.550 Median :0.085281 Median : 0.170561 Median :1469
## Mean :0.699 Mean :0.418699 Mean : 0.837398 Mean :1469
## 3rd Qu.:0.830 3rd Qu.:0.304734 3rd Qu.: 0.609469 3rd Qu.:1471
## Max. :2.550 Max. :7.937894 Max. :15.875787 Max. :1475
## min_z CC_height_Z CC_D1_X CC_D2_Y
## Min. :1463 Min. :0.1160 Min. :0.3350 Min. :0.318
## 1st Qu.:1466 1st Qu.:0.3219 1st Qu.:0.6620 1st Qu.:0.633
## Median :1469 Median :0.4410 Median :0.8359 Median :0.804
## Mean :1469 Mean :0.5160 Mean :0.9522 Mean :0.958
## 3rd Qu.:1471 3rd Qu.:0.5920 3rd Qu.:1.0620 3rd Qu.:1.079
## Max. :1475 Max. :1.8080 Max. :3.5659 Max. :3.813
## vol_method1_XY vol_method1_Andi CC_D1_longest CC_D2_perp
## Min. : 0.01513 Min. : 0.007568 Min. :0.304 Min. :0.2080
## 1st Qu.: 0.15255 1st Qu.: 0.076277 1st Qu.:0.666 1st Qu.:0.5880
## Median : 0.29727 Median : 0.148634 Median :0.847 Median :0.7500
## Mean : 0.99338 Mean : 0.496148 Mean :0.995 Mean :0.8686
## 3rd Qu.: 0.77999 3rd Qu.: 0.342892 3rd Qu.:1.162 3rd Qu.:0.9630
## Max. :25.74303 Max. :12.871518 Max. :3.747 Max. :3.3979
## vol_method2_longest vol_method2_Andi X2.5Vol_0.05_avg X2.5Vol_0.05_max
## Min. : 0.009141 Min. : 0.00457 Min. : 0.0090 Min. : 0.0110
## 1st Qu.: 0.150221 1st Qu.: 0.07506 1st Qu.: 0.0930 1st Qu.: 0.1030
## Median : 0.277976 Median : 0.13899 Median : 0.1840 Median : 0.2000
## Mean : 0.939220 Mean : 0.47607 Mean : 0.5962 Mean : 0.6475
## 3rd Qu.: 0.710022 3rd Qu.: 0.35501 3rd Qu.: 0.4160 3rd Qu.: 0.4510
## Max. :24.105574 Max. :12.05279 Max. :13.8140 Max. :14.2800
## X2.5Vol_0.025_avg X2.5Vol_0.025_max
## Min. : 0.0080 Min. : 0.0090
## 1st Qu.: 0.0870 1st Qu.: 0.0890
## Median : 0.1690 Median : 0.1720
## Mean : 0.5551 Mean : 0.5778
## 3rd Qu.: 0.3860 3rd Qu.: 0.4010
## Max. :12.8670 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_andi = mean(field_volume_Andi_m3 ),
min_vol_andi = min(field_volume_Andi_m3 ),
max_vol_andi = max(field_volume_Andi_m3 )
)
#export descriptive stats
#only run this once!
descriptive_stats<- write.csv(descriptive_stats, "shrub_field_size_descriptiveStats2.csv", row.names = F)
histogram view
gg_hist<- ggplot(vol, aes(x=field_volume_Andi_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_Andi_m3)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.004948 0.041584 0.085281 0.418699 0.304734 7.937894
#find two individual shrubs which were over 13 m^3 vol
dplyr::filter(vol, field_volume_Andi_m3 >7)
## Shrub_ID species_short_code species_full_code species_group
## 1 PUTR_14 PUTR PUTR2 PUTR
## 2 PUTR_9 PUTR PUTR2 PUTR
## species_name species_common rep ht_cm d1_cm d2_cm ht_m d1_m d2_m
## 1 Purshia tridentata Antelope bitterbrush 14 178 334 255 1.78 3.34 2.55
## 2 Purshia tridentata 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')
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_Andi_m3)
mean_vol_smallies = mean(vol_nobig$field_volume_Andi_m3)
#add to plot
gg_hist<- ggplot(vol, aes(x=field_volume_Andi_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_group
## 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_name species_common rep ht_cm
## Length:105 Length:105 Min. : 1.000 Min. : 19.0
## Class :character Class :character 1st Qu.: 4.000 1st Qu.: 38.0
## Mode :character Mode :character Median : 8.000 Median : 49.0
## Mean : 7.829 Mean : 57.1
## 3rd Qu.:12.000 3rd Qu.: 68.0
## Max. :15.000 Max. :178.0
##
## d1_cm d2_cm ht_m d1_m
## Min. : 23.00 Min. : 15.0 Min. :0.190 Min. :0.2300
## 1st Qu.: 56.00 1st Qu.: 38.0 1st Qu.:0.380 1st Qu.:0.5600
## Median : 75.00 Median : 55.0 Median :0.490 Median :0.7500
## Mean : 88.81 Mean : 69.9 Mean :0.571 Mean :0.8881
## 3rd Qu.:112.00 3rd Qu.: 83.0 3rd Qu.:0.680 3rd Qu.:1.1200
## Max. :334.00 Max. :255.0 Max. :1.780 Max. :3.3400
##
## d2_m field_volume_Andi_m3 field_volume_m3 mean_z
## Min. :0.150 Min. :0.004948 Min. : 0.009896 Min. :1463
## 1st Qu.:0.380 1st Qu.:0.041584 1st Qu.: 0.083168 1st Qu.:1466
## Median :0.550 Median :0.085281 Median : 0.170561 Median :1469
## Mean :0.699 Mean :0.418699 Mean : 0.837398 Mean :1469
## 3rd Qu.:0.830 3rd Qu.:0.304734 3rd Qu.: 0.609469 3rd Qu.:1471
## Max. :2.550 Max. :7.937894 Max. :15.875787 Max. :1475
##
## min_z CC_height_Z CC_D1_X CC_D2_Y
## Min. :1463 Min. :0.1160 Min. :0.3350 Min. :0.318
## 1st Qu.:1466 1st Qu.:0.3219 1st Qu.:0.6620 1st Qu.:0.633
## Median :1469 Median :0.4410 Median :0.8359 Median :0.804
## Mean :1469 Mean :0.5160 Mean :0.9522 Mean :0.958
## 3rd Qu.:1471 3rd Qu.:0.5920 3rd Qu.:1.0620 3rd Qu.:1.079
## Max. :1475 Max. :1.8080 Max. :3.5659 Max. :3.813
##
## vol_method1_XY vol_method1_Andi CC_D1_longest CC_D2_perp
## Min. : 0.01513 Min. : 0.007568 Min. :0.304 Min. :0.2080
## 1st Qu.: 0.15255 1st Qu.: 0.076277 1st Qu.:0.666 1st Qu.:0.5880
## Median : 0.29727 Median : 0.148634 Median :0.847 Median :0.7500
## Mean : 0.99338 Mean : 0.496148 Mean :0.995 Mean :0.8686
## 3rd Qu.: 0.77999 3rd Qu.: 0.342892 3rd Qu.:1.162 3rd Qu.:0.9630
## Max. :25.74303 Max. :12.871518 Max. :3.747 Max. :3.3979
##
## vol_method2_longest vol_method2_Andi X2.5Vol_0.05_avg X2.5Vol_0.05_max
## Min. : 0.009141 Min. : 0.00457 Min. : 0.0090 Min. : 0.0110
## 1st Qu.: 0.150221 1st Qu.: 0.07506 1st Qu.: 0.0930 1st Qu.: 0.1030
## Median : 0.277976 Median : 0.13899 Median : 0.1840 Median : 0.2000
## Mean : 0.939220 Mean : 0.47607 Mean : 0.5962 Mean : 0.6475
## 3rd Qu.: 0.710022 3rd Qu.: 0.35501 3rd Qu.: 0.4160 3rd Qu.: 0.4510
## Max. :24.105574 Max. :12.05279 Max. :13.8140 Max. :14.2800
##
## X2.5Vol_0.025_avg X2.5Vol_0.025_max
## Min. : 0.0080 Min. : 0.0090
## 1st Qu.: 0.0870 1st Qu.: 0.0890
## Median : 0.1690 Median : 0.1720
## Mean : 0.5551 Mean : 0.5778
## 3rd Qu.: 0.3860 3rd Qu.: 0.4010
## Max. :12.8670 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_Andi_m3),
min_vol = min(field_volume_Andi_m3),
max_vol = max(field_volume_Andi_m3)
)
descriptive_stats_noBig
## # A tibble: 8 x 17
## species_short_code count mean_fieldHeight_m median_fieldHeig~ min_fieldHeight~
## <fct> <int> <dbl> <dbl> <dbl>
## 1 ARAR 15 0.427 0.43 0.24
## 2 ARTRT 2 1.27 1.27 0.99
## 3 ARTRV 15 0.701 0.64 0.52
## 4 ARTRW 14 0.535 0.515 0.32
## 5 CHVI 14 0.358 0.39 0.19
## 6 ERNA 15 0.501 0.49 0.2
## 7 PUTR 13 0.88 0.84 0.31
## 8 TECA 15 0.368 0.37 0.28
## # ... with 12 more variables: max_fieldHeight_m <dbl>, mean_field_D1_m <dbl>,
## # median_field_D1_m <dbl>, min_field_D1_m <dbl>, max_field_D1_m <dbl>,
## # mean_field_D2_m <dbl>, median_field_D2_m <dbl>, min_field_D2_m <dbl>,
## # max_field_D2_m <dbl>, mean_vol <dbl>, min_vol <dbl>, max_vol <dbl>
Compare volume measurement techniques
library(ggplot2)
gg_vol1 = ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
stat_cor(aes(label = paste(..p.label..)), label.x.npc = 0.1,
label.y.npc = 2, size = 4) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed" ) +
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "c. 2.5D Method: avg, 5 cm cells")+
ylim(0,3)+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))
gg_vol1
## `geom_smooth()` using formula 'y ~ x'
## Warning: Computation failed in `stat_cor()`:
## '*.npc coord for y axis should be either a numeric value in [0-1] or a character strings including one of bottom, top, center, centre, middle
gg_vol2 <- ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_max)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "d. 2.5D Method: 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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol4 <- ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.025_avg)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "e. 2.5D Method: 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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol3 <- ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.025_max)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "f. 2.5D Method: 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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#summary(vol_nobig$vol_method1_Andi)
gg_vol5 <- ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = vol_method1_Andi)) +
geom_point(size = 2.5)+
ylim(0,4)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "a. CC-snap method")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 3.8, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 3.2, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#summary(vol_nobig$vol_method2_Andi)
gg_vol6 <- ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = vol_method2_Andi)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "b. Top-down method")+
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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#geom_smooth(method=lm)+
#combine into one plot
vol_figure <- ggarrange(
gg_vol5 + theme(axis.title.x = element_blank()),
gg_vol6 + theme(axis.title=element_blank()),
gg_vol1 + theme(axis.title.x = element_blank()),
gg_vol2 + theme(axis.title=element_blank()),
gg_vol4,
gg_vol3 +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'
## Warning: Computation failed in `stat_cor()`:
## '*.npc coord for y axis should be either a numeric value in [0-1] or a character strings including one of bottom, top, center, centre, middle
## `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)
## png
## 2
100 individuals
summary(vol_nobig$field_volume_Andi_m3)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.004948 0.041487 0.083860 0.279148 0.273798 2.633236
smalls <- vol_nobig %>%
filter(field_volume_Andi_m3 < 2)
summary(smalls$field_volume_Andi_m3)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.004948 0.041319 0.081192 0.219579 0.241815 1.555214
gg_vol1 = ggplot(smalls, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
stat_cor(aes(label = paste(..p.label..)), label.x.npc = 0.1,
label.y.npc = 2, size = 4) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed" ) +
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "c. 2.5D Method: avg, 5 cm cells")+
ylim(0,3)+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))
gg_vol1
## `geom_smooth()` using formula 'y ~ x'
## Warning: Computation failed in `stat_cor()`:
## '*.npc coord for y axis should be either a numeric value in [0-1] or a character strings including one of bottom, top, center, centre, middle
gg_vol2 <- ggplot(smalls, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_max)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "d. 2.5D Method: 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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol4 <- ggplot(smalls, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.025_avg)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "e. 2.5D Method: 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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol3 <- ggplot(smalls, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.025_max)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "f. 2.5D Method: 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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#summary(vol_nobig$vol_method1_Andi)
gg_vol5 <- ggplot(smalls, aes(x=field_volume_Andi_m3, y = vol_method1_Andi)) +
geom_point(size = 2.5)+
ylim(0,4)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "a. CC-snap method")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 3.8, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 3.2, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#summary(vol_nobig$vol_method2_Andi)
gg_vol6 <- ggplot(smalls, aes(x=field_volume_Andi_m3, y = vol_method2_Andi)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "b. Top-down method")+
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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#geom_smooth(method=lm)+
#combine into one plot
vol_smalls_figure <- ggarrange(
gg_vol5 + theme(axis.title.x = element_blank()),
gg_vol6 + theme(axis.title=element_blank()),
gg_vol1 + theme(axis.title.x = element_blank()),
gg_vol2 + theme(axis.title=element_blank()),
gg_vol4,
gg_vol3 +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'
## Warning: Computation failed in `stat_cor()`:
## '*.npc coord for y axis should be either a numeric value in [0-1] or a character strings including one of bottom, top, center, centre, middle
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
vol_smalls_figure
#save plots
#as jpeg
ggsave("Figures and Tables for manuscript/vol_comparison_smalls.jpeg", plot = vol_smalls_figure, device = "jpeg", width = 6, height = 8, dpi = 300, scale = 1)
#as svg
#save_plot("Figures and Tables for manuscript/vol_plot_smalls.svg", fig = vol_smalls_figure, width = 12, height = 16)
98 indidivuals
summary(vol_nobig$field_volume_Andi_m3)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.004948 0.041487 0.083860 0.279148 0.273798 2.633236
smalls_1 <- vol_nobig %>%
filter(field_volume_Andi_m3 < 1)
summary(smalls_1$field_volume_Andi_m3)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.004948 0.041177 0.079096 0.196975 0.234139 0.958183
gg_vol1 = ggplot(smalls_1, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
stat_cor(aes(label = paste(..p.label..)), label.x.npc = 0.1,
label.y.npc = 2, size = 4) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed" ) +
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "c. 2.5D Method: avg, 5 cm cells")+
ylim(0,3)+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))
gg_vol1
## `geom_smooth()` using formula 'y ~ x'
## Warning: Computation failed in `stat_cor()`:
## '*.npc coord for y axis should be either a numeric value in [0-1] or a character strings including one of bottom, top, center, centre, middle
gg_vol2 <- ggplot(smalls_1, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_max)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "d. 2.5D Method: 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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol4 <- ggplot(smalls_1, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.025_avg)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "e. 2.5D Method: 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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_vol3 <- ggplot(smalls_1, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.025_max)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "f. 2.5D Method: 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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#summary(vol_nobig$vol_method1_Andi)
gg_vol5 <- ggplot(smalls_1, aes(x=field_volume_Andi_m3, y = vol_method1_Andi)) +
geom_point(size = 2.5)+
ylim(0,4)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "a. CC-snap method")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 3.8, aes(label = ..eq.label..), size=4) +
stat_regline_equation(label.y = 3.2, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#summary(vol_nobig$vol_method2_Andi)
gg_vol6 <- ggplot(smalls_1, aes(x=field_volume_Andi_m3, y = vol_method2_Andi)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
labs(title = "b. Top-down method")+
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..), size=4) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label..), size=4)+
theme(plot.title = element_text(size = 12),
text = element_text(size=12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
#geom_smooth(method=lm)+
#combine into one plot
vol_smalls_figure <- ggarrange(
gg_vol5 + theme(axis.title.x = element_blank()),
gg_vol6 + theme(axis.title=element_blank()),
gg_vol1 + theme(axis.title.x = element_blank()),
gg_vol2 + theme(axis.title=element_blank()),
gg_vol4,
gg_vol3 +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'
## Warning: Computation failed in `stat_cor()`:
## '*.npc coord for y axis should be either a numeric value in [0-1] or a character strings including one of bottom, top, center, centre, middle
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
vol_smalls_figure
#save plots
#as jpeg
ggsave("Figures and Tables for manuscript/vol_comparison_smalls_less1.jpeg", plot = vol_smalls_figure, device = "jpeg", width = 6, height = 8, dpi = 300, scale = 1)
#as svg
#save_plot("Figures and Tables for manuscript/vol_plot_smalls.svg", fig = vol_smalls_figure, width = 12, height = 16)
facetted figure by species grouped subspecies of artr together
vol_nobig_noCHVI <- vol_nobig %>%
filter(!species_short_code %in% c('CHVI', 'ARTRT'))
summary(vol_nobig_noCHVI$species_short_code)
## ARAR ARTRT ARTRV ARTRW CHVI ERNA PUTR TECA
## 15 0 15 14 0 15 13 15
vol_nobig_noCHVI$species_short_code <-
factor(vol_nobig_noCHVI$species_short_code,
levels = c("ARTRV", "ARTRW", "PUTR",
"ARAR", "TECA", "ERNA"))
2.5D - 5 cm - avg
#summary(vol_nobig$vol_method2_Andi)
gg_vol6 <- ggplot(vol_nobig_noCHVI,
aes(x=field_volume_Andi_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('Point cloud volume '(m^3)))+
xlim(0,2.75)+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label.., size =2)) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label.., size = 2))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code, scales = "free")+
labs(title = "2.5D Method: average, 5 cm grid cells")+
theme(strip.background = element_blank(),
strip.text = element_text(hjust = 0, size = 12),
legend.position = "none")
gg_vol6
## `geom_smooth()` using formula 'y ~ x'
ggsave("Figures and Tables for manuscript/species_method/25D_5cm_avg.jpeg", plot = gg_vol6,
device = "jpeg", width = 6, height = 5, dpi = 300, scale = 1)
## `geom_smooth()` using formula 'y ~ x'
2.5D - 5 cm - max
gg_vol6 <- ggplot(vol_nobig_noCHVI, aes(x=field_volume_Andi_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('Point cloud volume '(m^3)))+
xlim(0,2.75)+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label.., size =2)) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label.., size = 2))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code, scales = "free")+
labs(title = "2.5D Method: max, 5 cm grid cells")+
theme(strip.background = element_blank(),
strip.text = element_text(hjust = 0, size = 12),
legend.position = "none")
gg_vol6
## `geom_smooth()` using formula 'y ~ x'
ggsave("Figures and Tables for manuscript/species_method/25D_5cm_max.jpeg", plot = gg_vol6,
device = "jpeg", width = 6, height = 5, dpi = 300, scale = 1)
## `geom_smooth()` using formula 'y ~ x'
X2.5Vol_0.025_avg X2.5Vol_0.025_max
2.5D - 2.5 cm - max
gg_vol6 <- ggplot(vol_nobig_noCHVI, aes(x=field_volume_Andi_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('Point cloud volume '(m^3)))+
xlim(0,2.75)+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label.., size =2)) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label.., size = 2))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code, scales = "free")+
labs(title = "2.5D Method: max, 2.5 cm grid cells")+
theme(strip.background = element_blank(),
strip.text = element_text(hjust = 0, size = 12),
legend.position = "none")
gg_vol6
## `geom_smooth()` using formula 'y ~ x'
ggsave("Figures and Tables for manuscript/species_method/25D_25cm_max.jpeg", plot = gg_vol6,
device = "jpeg", width = 6, height = 5, dpi = 300, scale = 1)
## `geom_smooth()` using formula 'y ~ x'
2.5D - 2.5 = avg
gg_vol6 <- ggplot(vol_nobig_noCHVI, aes(x=field_volume_Andi_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('Point cloud volume '(m^3)))+
xlim(0,2.75)+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 2.8, aes(label = ..eq.label.., size =2)) +
stat_regline_equation(label.y = 2.4, aes(label = ..rr.label.., size = 2))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code, scales = "free")+
labs(title = "2.5D Method: max, 2.5 cm grid cells")+
theme(strip.background = element_blank(),
strip.text = element_text(hjust = 0, size = 12),
legend.position = "none")
gg_vol6
## `geom_smooth()` using formula 'y ~ x'
ggsave("Figures and Tables for manuscript/species_method/25D_25cm_avg.jpeg", plot = gg_vol6,
device = "jpeg", width = 6, height = 5, dpi = 300, scale = 1)
## `geom_smooth()` using formula 'y ~ x'
cc-snap
#summary(vol_nobig$vol_method2_Andi)
gg_vol6 <- ggplot(vol_nobig_noCHVI, aes(x=field_volume_Andi_m3, y = vol_method1_Andi,
color=species_short_code)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
xlim(0,2.75)+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 3.8, aes(label = ..eq.label.., size =1)) +
stat_regline_equation(label.y = 3.2, aes(label = ..rr.label.., size = 1))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code, scales = "free")+
labs(title = "CC-snap method")+
theme(strip.background = element_blank(),
strip.text = element_text(hjust = 0, size = 12),
legend.position = "none")
gg_vol6
## `geom_smooth()` using formula 'y ~ x'
ggsave("Figures and Tables for manuscript/species_method/ccsnap.jpeg", plot = gg_vol6,
device = "jpeg", width = 6, height = 5, dpi = 300, scale = 1)
## `geom_smooth()` using formula 'y ~ x'
top-down
#summary(vol_nobig$vol_method2_Andi)
gg_vol6 <- ggplot(vol_nobig_noCHVI, aes(x=field_volume_Andi_m3, y = vol_method2_Andi,
color=species_short_code)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Point cloud volume '(m^3)))+
xlim(0,2.75)+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 3.8, aes(label = ..eq.label.., size =2)) +
stat_regline_equation(label.y = 3.2, aes(label = ..rr.label.., size = 2))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code, scales = "free")+
labs(title = "Top-down method")+
theme(strip.background = element_blank(),
strip.text = element_text(hjust = 0, size = 12),
legend.position = "none")
gg_vol6
## `geom_smooth()` using formula 'y ~ x'
ggsave("Figures and Tables for manuscript/species_method/topdown.jpeg", plot = gg_vol6,
device = "jpeg", width = 6, height = 5, dpi = 300, scale = 1)
## `geom_smooth()` using formula 'y ~ x'
interactive figure
library(ggplot2)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(gapminder)
## Warning: package 'gapminder' was built under R version 4.0.5
p <- ggplot(vol_nobig, aes(x=field_volume_m3, y = X2.5Vol_0.05_avg,
color=species_short_code)) +
geom_point(size = 2.5)+
scale_color_brewer(palette="Dark2")+theme_classic()
p
ggplotly(p)
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()),
table for linear regressions for each species & method
# create a list of species
summary(vol_nobig$species_short_code)
## ARAR ARTRT ARTRV ARTRW CHVI ERNA PUTR TECA
## 15 2 15 14 14 15 13 15
species_list <- c("ARAR", "ARTRT", "ARTRV", "ARTRW",
"CHVI", "ERNA", "PUTR", "TECA" )
# create a list of the response variable names
response_vars <- c("X2.5Vol_0.05_avg", "X2.5Vol_0.05_max", "X2.5Vol_0.025_avg", "X2.5Vol_0.025_max","vol_method1_Andi", "vol_method2_Andi" )
# create empty vectors to store the output
p_values <- vector("numeric", length(response_vars))
slopes <- vector("numeric", length(response_vars))
r_squared <- vector("numeric", length(response_vars))
# loop over the species and response variables and fit linear models
results_list <- list()
for (ii in seq_along(species_list)) {
species_data <- vol_nobig %>%
filter(species_short_code == species_list[ii])
for (i in seq_along(response_vars)) {
formula <- paste(response_vars[i], "~ field_volume_Andi_m3")
fit <- lm(formula, data = species_data)
# extract the p-value, slope, and r-squared
p_value <- summary(fit)$coefficients[2, 4]
slope <- coef(fit)[2]
r_squared <- summary(fit)$r.squared
# add the results to the list
results_list[[length(results_list) + 1]] <- list(Species = species_list[ii],
Response = response_vars[i],
P_value = ifelse(p_value < 0.05, paste0(format(p_value, digits = 2), "**"), format(p_value, digits = 2)),
Slope = slope,
R_squared = r_squared)
}
}
# convert the list to a data frame
results_df <- do.call(rbind, results_list)
write.csv(results_df, "results_species_vol_methods.csv", row.names = F)
summary(vol_nobig$CC_height_Z)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.1160 0.3209 0.4310 0.4940 0.5860 1.3910
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 = "a. All shrubs")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
xlim(0,1.6)+ylim(0,1.6)+
stat_regline_equation(label.y = 1.35, aes(label = ..eq.label..), size = 4) +
stat_regline_equation(label.y = 1.25, aes(label = ..rr.label..), size = 4)+
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/all_height.jpeg", plot = gg_height2, device = "jpeg",
width = 4, height = 4, dpi = 300, scale = 1)
## `geom_smooth()` using formula 'y ~ x'
shorties <- filter(vol, ht_m < 1.5) #101 out of 105 indiv
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 = "b. Only shrubs <1.5 m field height")+
scale_color_brewer(palette="Dark2")+theme_classic()+
xlim(0,2)+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 1.35, aes(label = ..eq.label..), size = 4) +
stat_regline_equation(label.y = 1.25, aes(label = ..rr.label..), size = 4)+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_height_shorties
## `geom_smooth()` using formula 'y ~ x'
#save figure
ggsave("Figures and Tables for manuscript/height/height_shorties.jpeg", plot = gg_height_shorties, device = "jpeg",
width = 4, height = 4, dpi = 300, scale = 1)
## `geom_smooth()` using formula 'y ~ x'
#combine shorties and all into one figure
#combine into one plot
ht_figure <- ggarrange(
gg_height2,
gg_height_shorties + theme(axis.title.y=element_blank()),
ncol = 2, nrow = 1)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
ht_figure
#save plots
#as jpeg
ggsave("Figures and Tables for manuscript/height/ht_comparison_1.5m.jpeg", plot = ht_figure, device = "jpeg", width = 6, height = 3, dpi = 300, scale = 1)
#super shorties
super_shorties <- filter(vol, ht_m < 1) #97 are <1 m; 82 are <0.75
gg_height_sshorties <- ggplot(super_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 = "b. Only shrubs < 1 m field 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 = 4) +
stat_regline_equation(label.y = 1.25, aes(label = ..rr.label..), size = 4)+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )
gg_height_sshorties
## `geom_smooth()` using formula 'y ~ x'
#combine into one plot
ht_figure <- ggarrange(
gg_height2,
gg_height_sshorties + theme(axis.title.y=element_blank()),
ncol = 2, nrow = 1)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
ht_figure
#save plots
#as jpeg
ggsave("Figures and Tables for manuscript/height/ht_comparison_1m.jpeg", plot = ht_figure, device = "jpeg", width = 6, height = 3, dpi = 300, scale = 1)
interactive height figure
height_plotly <- ggplot(vol_nobig, aes(x=ht_m, y = CC_height_Z,
color=species_short_code, text = Shrub_ID)) +
geom_point(size = 2.5)+
scale_color_brewer(palette="Dark2")+theme_classic()
height_plotly
ggplotly(height_plotly)
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 = 6, height = 6, dpi = 300, scale = 1)
plotly for top down d2
head(vol_nobig)
## Shrub_ID species_short_code species_full_code species_group
## 1 ARAR_1 ARAR ARAR8 ARAR
## 2 ARAR_10 ARAR ARAR8 ARAR
## 3 ARAR_11 ARAR ARAR8 ARAR
## 4 ARAR_12 ARAR ARAR8 ARAR
## 5 ARAR_13 ARAR ARAR8 ARAR
## 6 ARAR_14 ARAR ARAR8 ARAR
## species_name species_common rep ht_cm d1_cm d2_cm ht_m d1_m d2_m
## 1 Artemisia arbuscula low sagebrush 1 50 58 21 0.50 0.58 0.21
## 2 Artemisia arbuscula low sagebrush 10 49 136 152 0.49 1.36 1.52
## 3 Artemisia arbuscula low sagebrush 11 24 52 30 0.24 0.52 0.30
## 4 Artemisia arbuscula low sagebrush 12 40 49 36 0.40 0.49 0.36
## 5 Artemisia arbuscula low sagebrush 13 43 61 48 0.43 0.61 0.48
## 6 Artemisia arbuscula low sagebrush 14 34 75 49 0.34 0.75 0.49
## field_volume_Andi_m3 field_volume_m3 mean_z min_z CC_height_Z CC_D1_X
## 1 0.03188717 0.06377433 1467.270 1467.251 0.357056 0.780029
## 2 0.53036786 1.06073572 1469.192 1469.107 0.559082 1.219023
## 3 0.01960354 0.03920708 1469.696 1469.652 0.205078 0.464966
## 4 0.03694513 0.07389026 1468.343 1468.335 0.355957 0.562988
## 5 0.06592318 0.13184636 1469.904 1469.867 0.358032 0.718994
## 6 0.06542367 0.13084733 1467.564 1467.537 0.328979 0.713013
## CC_D2_Y vol_method1_XY vol_method1_Andi CC_D1_longest CC_D2_perp
## 1 0.620972 0.18111221 0.09055610 0.942993 0.772034
## 2 1.737023 1.23971426 0.61985713 1.729311 1.798080
## 3 0.509949 0.05092085 0.02546042 0.569946 0.489990
## 4 0.592957 0.12443670 0.06221835 0.738037 0.705994
## 5 0.643982 0.17359990 0.08679995 0.757996 0.588013
## 6 0.830017 0.20388310 0.10194155 0.838989 0.765991
## vol_method2_longest vol_method2_Andi X2.5Vol_0.05_avg X2.5Vol_0.05_max
## 1 0.27221362 0.13610681 0.142 0.157
## 2 0.31194991 0.91024069 0.975 1.029
## 3 0.05997477 0.02998739 0.095 0.107
## 4 0.19422508 0.09711254 0.092 0.104
## 5 0.16711072 0.08355536 1.845 1.855
## 6 0.22139955 0.11069977 0.105 0.115
## X2.5Vol_0.025_avg X2.5Vol_0.025_max
## 1 0.132 0.137
## 2 0.937 0.952
## 3 0.090 0.094
## 4 0.087 0.091
## 5 1.666 1.668
## 6 0.098 0.101
d2_plotly <- ggplot(vol_nobig, aes(x=d2_m, y = CC_D2_perp,
color=species_short_code, text=Shrub_ID)) +
labs(x = "Field width (m)", y = "CC width (m)",
title="d. D2 - Top-down method", color = "Species")+
geom_point(size = 2.5)+
scale_color_brewer(palette="Dark2")+theme_classic()
d2_plotly
ggplotly(d2_plotly)
d2_plotly <- ggplot(vol_nobig, aes(x=d2_m, y = CC_D2_Y,
color=species_short_code, text=Shrub_ID)) +
labs(x = "Field width (m)", y = "CC width (m)",
title="c. D2 - CC-snap method", color = "Species")+
geom_point(size = 2.5)+
scale_color_brewer(palette="Dark2")+theme_classic()
d2_plotly
ggplotly(d2_plotly)
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" )
Height - by species
d1 - by species - CC snap d1 - by species - top down d2 - by species - CC snap d2 - by species - top down
not using
arar = ggplot(vol %>% filter(species_short_code == 'ARAR'),
aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+ 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" ) +
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "ARAR")+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12))
arar
## `geom_smooth()` using formula 'y ~ x'
artrv = ggplot(vol %>% filter(species_short_code == 'ARTRV'),
aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+ 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" ) +
xlab(bquote('Field measured volume '(m^3)))+ ylab(bquote('Volume '(m^3)))+
labs(title = "ARTRV")+ scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12))
artrv
## `geom_smooth()` using formula 'y ~ x'
putr = ggplot(vol_nobig %>% filter(species_short_code == 'PUTR'),
aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+ 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" ) +
xlab(bquote('Field measured volume '(m^3)))+ ylab(bquote('Volume '(m^3)))+
labs(title = "PUTR")+scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12))
putr
## `geom_smooth()` using formula 'y ~ x'
artrw = ggplot(vol_nobig %>% filter(species_short_code == 'ARTRW'),
aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+ 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" ) +
xlab(bquote('Field measured volume '(m^3)))+ ylab(bquote('Volume '(m^3)))+
labs(title = "ARTRW")+scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12))
artrw
## `geom_smooth()` using formula 'y ~ x'
teca = ggplot(vol_nobig %>% filter(species_short_code == 'TECA'),
aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+ 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" ) +
xlab(bquote('Field measured volume '(m^3)))+ ylab(bquote('Volume '(m^3)))+
labs(title = "TECA")+ scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12))
teca
## `geom_smooth()` using formula 'y ~ x'
chvi = ggplot(vol_nobig %>% filter(species_short_code == 'CHVI'),
aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+ 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" ) +
xlab(bquote('Field measured volume '(m^3)))+ ylab(bquote('Volume '(m^3)))+
labs(title = "CHVI")+ scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12))
chvi
## `geom_smooth()` using formula 'y ~ x'
erna = ggplot(vol_nobig %>% filter(species_short_code == 'ERNA'),
aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+ 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" ) +
xlab(bquote('Field measured volume '(m^3)))+ ylab(bquote('Volume '(m^3)))+
labs(title = "ERNA")+ scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12))
erna
## `geom_smooth()` using formula 'y ~ x'
artr = ggplot(vol_nobig %>% filter(species_short_code == 'ARTRW'|
species_short_code == 'ARTRV' |
species_short_code == 'ARTRV'),
aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+ 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" ) +
xlab(bquote('Field measured volume '(m^3)))+ ylab(bquote('Volume '(m^3)))+
labs(title = "ARTR")+scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12))
artr
## `geom_smooth()` using formula 'y ~ x'
#combine into one plot
sp_fig <- ggarrange(artr + theme(axis.title.x = element_blank()),
putr+ theme(axis.title=element_blank()),
arar+ theme(axis.title=element_blank()), teca,
chvi + theme(axis.title.y=element_blank()), erna + theme(axis.title.y=element_blank()),
ncol = 3, 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'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
sp_fig
by species
gg_vol1 = ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg)) +
geom_point(size = 2.5)+
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" ) +
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "2.5D: avg, 5 cm cells")+
ylim(0,3)+
scale_color_brewer(palette="Dark2")+theme_classic()+
theme(plot.title = element_text(size = 12))+
facet_wrap(~species_group)
gg_vol1
## `geom_smooth()` using formula 'y ~ x'
gg_vol2 <- ggplot(vol_nobig, aes(x=field_volume_Andi_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 = "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..))+
theme(plot.title = element_text(size = 12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code)
gg_vol2
## `geom_smooth()` using formula 'y ~ x'
#geom_smooth(method=lm)+
gg_vol4 <- ggplot(vol_nobig, aes(x=field_volume_Andi_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 = "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..))+
theme(plot.title = element_text(size = 12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code)
gg_vol4
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing missing values (geom_smooth).
#geom_smooth(method=lm)+
gg_vol3 <- ggplot(vol_nobig, aes(x=field_volume_Andi_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 = "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..))+
theme(plot.title = element_text(size = 12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code)
gg_vol3
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing missing values (geom_smooth).
#geom_smooth(method=lm)+
#summary(vol_nobig$vol_method1_Andi)
gg_vol5 <- ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = vol_method1_Andi)) +
geom_point(size = 2.5)+
ylim(0,4)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "CC-snap method")+
scale_color_brewer(palette="Dark2")+theme_classic()+
geom_smooth(method = "lm", se=FALSE) +
stat_regline_equation(label.y = 3.8, aes(label = ..eq.label..)) +
stat_regline_equation(label.y = 3.2, aes(label = ..rr.label..))+
theme(plot.title = element_text(size = 12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code)
gg_vol5
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 2 rows containing missing values (geom_smooth).
#geom_smooth(method=lm)+
#summary(vol_nobig$vol_method2_Andi)
gg_vol6 <- ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = vol_method2_Andi)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^3)))+
labs(title = "Top-down method")+
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..))+
theme(plot.title = element_text(size = 12))+
geom_abline(slope = 1, intercept = 0, linetype = "dashed" )+
facet_wrap(~species_short_code)
gg_vol6
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 2 rows containing missing values (geom_smooth).
#geom_smooth(method=lm)+