-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathNYtreesVali_Fig5.R
102 lines (55 loc) · 2.71 KB
/
NYtreesVali_Fig5.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
library(dplyr)
library(foreign)
library(Metrics)
# setwd("C:/Users/maqin/Nutstore/1/我的坚果云/NYtrees")
ss= read.csv('./Plot_TreeSeg_S.csv')
err <- matrix(0,nrow=3,ncol=6)
err = as.data.frame(err)
colnames(err) = c('V','R2','RMSE','bia','MAE','Rbia')
err[,'V']=c('NT','Hmn','Hmax')
err[1,'R2']=round((cor(ss$NF,ss$NL))^2,2)
err[2,'R2']=round((cor(ss$HFmn,ss$HLmn))^2,2)
err[3,'R2']=round((cor(ss$HFmax,ss$HLmax))^2,2)
err[1,'RMSE']=round(rmse(ss$NF,ss$NL),2)
err[2,'RMSE']=round(rmse(ss$HFmn,ss$HLmn),2)
err[3,'RMSE']=round(rmse(ss$HFmax,ss$HLmax),2)
err[1,'bia']=round(mean(ss$NL)-mean(ss$NF),2)
err[2,'bia']=round(mean(ss$HLmn)-mean(ss$HFmn),2)
err[3,'bia']=round(mean(ss$HLmax)-mean(ss$HFmax),2)
err[1,'Rbia']=round( (mean(ss$NL)-mean(ss$NF))/mean(ss$NF)*100,2)
err[2,'Rbia']=round( (mean(ss$HLmn)-mean(ss$HFmn))/mean(ss$HFmn)*100,2)
err[3,'Rbia']=round( (mean(ss$HLmax)-mean(ss$HFmax))/mean(ss$HFmax)*100,2)
err[1,'MAE']= round(mean(abs(ss$NL-ss$NF)),2)
err[2,'MAE']=round(mean(abs(ss$HFmn-ss$HLmn)),2)
err[3,'MAE']=round(mean(abs(ss$HFmax-ss$HLmax)),2)
write.csv(err,'./err.csv')
library(ggplot2)
library("gridExtra")
# Basic scatter plot
pN = ggplot(ss, aes(x=ss$NL, y=ss$NF)) + geom_point(size=1.5)+
# stat_smooth(method = 'lm', formula = y ~ poly(x,2), aes(colour = 'polynomial'), se= TRUE)+
theme_bw()+theme( legend.position="none")+
scale_x_continuous('LiDAR NT', limits=c(0,40))+
scale_y_continuous('Field NT', limits=c(0,40))+
geom_abline(intercept = 0, slope = 1, color="grey",linetype="dashed", size=0.5)
pN
ggsave(plot = pN, width = 4, height = 4, dpi = 600,
filename = "./NT.jpg")
pHm = ggplot(ss, aes(x=ss$HLmn, y=ss$HFmn)) + geom_point(size=1.5)+
# stat_smooth(method = 'lm', formula = y ~ poly(x,2), aes(colour = 'polynomial'), se= TRUE)+
theme_bw()+theme( legend.position="none")+
scale_x_continuous('LiDAR mean height,m', limits=c(0,25))+
scale_y_continuous('Field mean height,m', limits=c(0,25))+
geom_abline(intercept = 0, slope = 1, color="grey",linetype="dashed", size=0.5)
pHm
ggsave(plot = pHm, width = 4, height = 4, dpi = 600,
filename = "./Hmn.jpg")
pHmax = ggplot(ss, aes(x=ss$HLmax, y=ss$HFmax)) + geom_point(size=1.5)+
# stat_smooth(method = 'lm', formula = y ~ poly(x,2), aes(colour = 'polynomial'), se= TRUE)+
theme_bw()+theme( legend.position="none")+
scale_x_continuous('LiDAR max height,m', limits=c(0,30))+
scale_y_continuous('Field max height,m', limits=c(0,30))+
geom_abline(intercept = 0, slope = 1, color="grey",linetype="dashed", size=0.5)
pHmax
ggsave(plot = pHmax, width = 4, height = 4, dpi = 600,
filename = "./Hmax.jpg")