-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOFData2.R
63 lines (53 loc) · 2.29 KB
/
OFData2.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
pacman::p_load(pacman, akima, ggplot2, mgcv, MASS, plotly, latex2exp, extrafont,ggpubr,scales)
theory_max_dist <- data.frame(
x=c(0,40),
y=c(0.7,1.5)
)
setwd("/run/media/boyuan/DEEPINOS/719FourPeriods_LowFr")
xlist <- list.files(pattern = "*.csv")
maxDepth <- matrix(0,length(xlist),1)
for(i in c(1:length(xlist))) {
dataset <- read.csv(paste0((i-1),"sur.csv"),header = T)
maxDepth[i]<- max(dataset$Points.1)
}
maxTimeSeries <- data.frame(
Time=c(0:216),
MaxDepth=c(0.70,maxDepth)
)
p1 <- ggplot(maxTimeSeries,aes(Time,MaxDepth)) +
geom_point(shape=1, size=2) +
geom_smooth(span=0.5) +
theme(text=element_text(family="Latin Modern Roman", size=18)) +
xlab("Time (s)") +ylab(TeX("\\textit{$h_{max}}$ (m)")) +
scale_y_continuous(trans = log10_trans(),limits = c(0.60,1.5), breaks = seq(0.6,1.5,by=0.3)) +
scale_x_continuous(breaks = seq(0,220,by=40), limits = c(0,220)) +
theme(aspect.ratio = 1) +
geom_abline(intercept=0.7,slope=0.029075,size=2, lty=2, color="red") +
geom_line(data=theory_max_dist,aes(x,y),size=1, lty=2, color="red")
setwd("/run/media/boyuan/DEEPINOS/719EightPeriods_LowFr")
xlist <- list.files(pattern = "*.csv")
maxDepth <- matrix(0,length(xlist),1)
for(i in c(1:length(xlist))) {
dataset <- read.csv(paste0((i-1),"sur.csv"),header = T)
maxDepth[i]<- max(dataset$Points.1)
}
maxTimeSeries <- data.frame(
Time=c(0:162),
MaxDepth=c(0.70,maxDepth)
)
p2 <- ggplot(maxTimeSeries,aes(Time,MaxDepth)) +
geom_point(shape=1, size=2) +
geom_smooth(span=0.5) +
theme(text=element_text(family="Latin Modern Roman", size=18)) +
xlab("Time (s)") +ylab(TeX("\\textit{$h_{max}}$ (m)")) +
scale_y_continuous(trans = log10_trans(),limits = c(0.60,1.5), breaks = seq(0.6,1.5,by=0.3)) +
scale_x_continuous(breaks = seq(0,170,by=40), limits = c(0,170)) +
theme(aspect.ratio = 1) +
geom_abline(intercept=0.7,slope=0.029075,size=2, lty=2, color="red") +
geom_line(data=theory_max_dist,aes(x,y),size=1, lty=2, color="red")
########multiplot#############
margin_val <- c(0.01,0.0,0.5,2)
ggarrange(p1+theme(plot.margin = unit(margin_val, "lines")),p2+theme(plot.margin = unit(margin_val, "lines"))
, ncol=2,nrow=1,labels = c("(a) Case VII","(b) Case VIII")
,font.label = list(family="Latin Modern Roman",size=16) ,hjust = -0.4, vjust = 8,align = "v"
)