forked from LasseDamtoft/InteriorEdgeExtension
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.figure.R
More file actions
27 lines (26 loc) · 1.03 KB
/
plot.figure.R
File metadata and controls
27 lines (26 loc) · 1.03 KB
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
plot.figure <- function(df){
filters <- df$t %>% unique() %>% as.character()
v <- lapply(filters, function(filter){
# new_df <- df %>% filter(t == m.filter)
new.df <- df[df$t == filter,]%>% rbind(df[df$t== filter,][1,])
if (filter == filters[1]) {
plot(new.df[,1:2], type = 'l', lwd = 2, col = 'blue')
}else{
lines(new.df[,1:2], type = 'l', lwd = 2, col = 'red')
obs.x <- new.df[,1] %>% as.matrix() %>% as.numeric()
obs.y <- new.df[,2] %>% as.matrix() %>% as.numeric()
polygon(obs.x, obs.y, col = "grey70", border = NA)
}
})
}
lines.figure <- function(df){
filters <- df$t %>% unique() %>% as.character()
v <- lapply(filters, function(filter){
# new_df <- df %>% filter(t == m.filter)
new.df <- df[df$t == filter,]%>% rbind(df[df$t== filter,][1,])
obs.x <- new.df[,1] %>% as.matrix() %>% as.numeric()
obs.y <- new.df[,2] %>% as.matrix() %>% as.numeric()
polygon(obs.x, obs.y, col = "chocolate", border = NA)
lines(new.df[,1:2], type = 'l', lwd = 2, col = 'black')
})
}