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
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.5118 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.3040 Min. :0.208
## 1st Qu.: 0.15255 1st Qu.: 0.076277 1st Qu.:0.6660 1st Qu.:0.588
## Median : 0.29727 Median : 0.148634 Median :0.8529 Median :0.750
## Mean : 0.99338 Mean : 0.496692 Mean :0.9972 Mean :0.857
## 3rd Qu.: 0.77999 3rd Qu.: 0.389992 3rd Qu.:1.1620 3rd Qu.:0.960
## Max. :25.74303 Max. :12.871518 Max. :3.7469 Max. :3.398
## 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.07511 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.46961 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.5118 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.3040 Min. :0.208
## 1st Qu.: 0.15255 1st Qu.: 0.076277 1st Qu.:0.6660 1st Qu.:0.588
## Median : 0.29727 Median : 0.148634 Median :0.8529 Median :0.750
## Mean : 0.99338 Mean : 0.496692 Mean :0.9972 Mean :0.857
## 3rd Qu.: 0.77999 3rd Qu.: 0.389992 3rd Qu.:1.1620 3rd Qu.:0.960
## Max. :25.74303 Max. :12.871518 Max. :3.7469 Max. :3.398
##
## 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.07511 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.46961 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
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))
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" )
#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" )
#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" )
#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" )
#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" )
#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)
## png
## 2
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_short_code)
gg_vol1
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing missing values (geom_smooth).
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 4 rows containing missing values (geom_smooth).
#geom_smooth(method=lm)+
facetted figure by species grouped subspecies of artr together
vol_nobig$species_group <- factor(vol_nobig$species_group,
levels = c("ARTR", "PUTR", "ARAR", "TECA", "ERNA", "CHVI"))
#summary(vol_nobig$vol_method2_Andi)
gg_vol6 <- ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = X2.5Vol_0.05_avg,
color=species_group)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^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 =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_group, scales = "free")+
labs(title = "Volumetric: 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'
#summary(vol_nobig$vol_method2_Andi)
gg_vol6 <- ggplot(vol_nobig, aes(x=field_volume_Andi_m3, y = vol_method1_Andi,
color=species_group)) +
geom_point(size = 2.5)+
xlab(bquote('Field measured volume '(m^3)))+
ylab(bquote('Volume '(m^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 =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_group, scales = "free")+
labs(title = "Allometric: CC-Snap")+
theme(strip.background = element_blank(),
strip.text = element_text(hjust = 0, size = 12),
legend.position = "none")
gg_vol6
## `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()),
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