-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
276 lines (276 loc) · 12.1 KB
/
.Rhistory
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
?melt
library(reshape2)
?melt
profile_data <- read.csv("/Users/Valentin/Library/Mobile Documents/3L68KQB4HG~com~readdle~CommonDocuments/Documents/Ingenieur-und-Hydro/4 MASTERARBEIT/2 GIS/4-2 Rockyfor3D DGM TLS/fallhoehenvariation/analysis/profile_data.csv", header = T)
profile_data_oXY = profile_data[-2:-3] # remove X and Y (we dont want to plot them)
View(profile_data_oXY)
View(profile_data_oXY)
test <- melt(profile_data_oXY, measure.vars = c("Ph_95Cl", "E_95Cl"))
test <- melt(profile_data_oXY, measure.vars = c("Ph_95Cl*", "E_95Cl*"))
?names
names(profile_data_oXY)
grep("PH_Cl", names(profile_data_oXY))
grep("Ph_Cl", names(profile_data_oXY))
grep("Ph", names(profile_data_oXY))
grep("Ph_95CI_", names(profile_data_oXY))
names(grep("Ph_95CI_", names(profile_data_oXY)))
grep("Ph_95CI_", names(profile_data_oXY)
)
grep("Ph_95CI_", names(profile_data_oXY), value = T)
E_keep = grep("E_95CI_", names(profile_data_oXY), value = T)
# Optionally: Filter only for E and Ph:
Ph_keep = grep("Ph_95CI_", names(profile_data_oXY), value = T)
c(Ph_keep, E_keep)
?melt
keep_cols <- c(Ph_keep, E_keep)
profile_data_oXY <- melt(profile_data_oXY, id.vars="Length", measure.vars=keep_cols)
View(profile_data_oXY)
summary(profile_data_oXY)
summary(profile_data_oXY$variable)
keep_cols <- names(profile_data_oXY)
profile_data_oXY <- melt(profile_data_oXY, id.vars="Length", measure.vars=keep_cols)
profile_data_oXY = profile_data[-2:-3] # remove X and Y (we dont want to plot them)
keep_cols <- names(profile_data_oXY)
profile_data_oXY <- melt(profile_data_oXY, id.vars="Length", measure.vars=keep_cols)
# Everything on the same plot
p1 <- ggplot(profile_data_oXY, aes(Length,value, col=variable)) +
geom_point() +
stat_smooth()
# Separate plots
p2 <- ggplot(profile_data_oXY, aes(Length,value)) +
geom_line() +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5,scales = "free_y")
p3 <- ggplot(profile_data_oXY, aes(Length,value)) +
geom_line() +
ylim(0,10) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
print(p1)
print(p2)
print(p3)
library(ggplot2)
# Everything on the same plot
p1 <- ggplot(profile_data_oXY, aes(Length,value, col=variable)) +
geom_point() +
stat_smooth()
# Separate plots
p2 <- ggplot(profile_data_oXY, aes(Length,value)) +
geom_line() +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5,scales = "free_y")
p3 <- ggplot(profile_data_oXY, aes(Length,value)) +
geom_line() +
ylim(0,10) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
print(p1)
print(p2)
print(p3)
View(profile_data_oXY)
profile_data_oXY = profile_data[-2:-3] # remove X and Y (we dont want to plot them)
# Optionally: Filter only for E and Ph:
keep_only_E_and_Ph <- T
if (keep_only_E_and_Ph == T){
Ph_keep = grep("Ph_95CI_", names(profile_data_oXY), value = T)
E_keep = grep("E_95CI_", names(profile_data_oXY), value = T)
keep_cols <- c(Ph_keep, E_keep)
} else {
keep_cols <- names(profile_data_oXY)
}
profile_data_oXY <- melt(profile_data_oXY, id.vars="Length", measure.vars=keep_cols)
# Everything on the same plot
p1 <- ggplot(profile_data_oXY, aes(Length,value, col=variable)) +
geom_point() +
stat_smooth()
# Separate plots
p2 <- ggplot(profile_data_oXY, aes(Length,value)) +
geom_line() +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5,scales = "free_y")
p3 <- ggplot(profile_data_oXY, aes(Length,value)) +
geom_line() +
ylim(0,10) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
print(p1)
print(p2)
print(p3)
# a3 297 x 420
ggsave(filename="Plot1.pdf", plot = p1, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col.pdf", plot = p2, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col-10mYlim.pdf", plot = p3, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
# a3 297 x 420
outpath = "/Users/Valentin/Library/Mobile Documents/3L68KQB4HG~com~readdle~CommonDocuments/Documents/Ingenieur-und-Hydro/4 MASTERARBEIT/2 GIS/4-2 Rockyfor3D DGM TLS/fallhoehenvariation/analysis/nurPh_E"
ggsave(filename="Plot1.pdf", plot = p1, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col.pdf", plot = p2, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col-10mYlim.pdf", plot = p3, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
library("optparse")
library(ggplot2)
library(reshape2)
# print("start R session form py")
#
# option_list = list(
# make_option(c("-f", "--file"), type="character", default=NULL,
# help="dataset file name", metavar="character"),
# make_option(c("-o", "--out"), type="character", default="./",
# help="output folder name [default= %default]", metavar="character")
# );
#
# opt_parser = OptionParser(option_list=option_list);
# opt = parse_args(opt_parser);
# if (is.null(opt$file)){
# print_help(opt_parser)
# stop("At least one argument must be supplied (input file).n", call.=FALSE)
# }
#### MAIN
outpath = "/Users/Valentin/Library/Mobile Documents/3L68KQB4HG~com~readdle~CommonDocuments/Documents/Ingenieur-und-Hydro/4 MASTERARBEIT/2 GIS/4-2 Rockyfor3D DGM TLS/fallhoehenvariation/analysis/nurPh_E"
filename = "/Users/Valentin/Library/Mobile Documents/3L68KQB4HG~com~readdle~CommonDocuments/Documents/Ingenieur-und-Hydro/4 MASTERARBEIT/2 GIS/4-2 Rockyfor3D DGM TLS/fallhoehenvariation/analysis/profile_data.csv"
profile_data <- read.csv(filename, header = T)
profile_data_oXY = profile_data[-2:-3] # remove X and Y (we dont want to plot them)
# Optionally: Filter only for E and Ph:
keep_only_E_and_Ph <- T
if (keep_only_E_and_Ph == T){
Ph_keep = grep("Ph_95CI_", names(profile_data_oXY), value = T)
E_keep = grep("E_95CI_", names(profile_data_oXY), value = T)
keep_cols <- c(Ph_keep, E_keep)
profile_data_oXY_E <- melt(profile_data_oXY, id.vars="Length", measure.vars=E_keep)
profile_data_oXY_Ph <- melt(profile_data_oXY, id.vars="Length", measure.vars=Ph_keep)
} else {
keep_cols <- names(profile_data_oXY)
}
profile_data_oXY <- melt(profile_data_oXY, id.vars="Length", measure.vars=keep_cols)
# VARIANTE 1: PH UND E AUF SELBEN PLOT
p1 <- ggplot(profile_data_oXY, aes(Length,value, col=variable)) +
geom_point() +
stat_smooth()
# Separate plots
p2 <- ggplot(profile_data_oXY, aes(Length,value)) +
geom_line() +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5,scales = "free_y")
p3 <- ggplot(profile_data_oXY, aes(Length,value)) +
geom_line() +
ylim(0,10) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
# VARIANTE 1: E AUF PLOT
p4 <- ggplot(profile_data_oXY_E, aes(Length,value, col=variable)) +
geom_point() +
stat_smooth()
# Separate plots
p5 <- ggplot(profile_data_oXY_E, aes(Length,value)) +
geom_line() +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5,scales = "free_y")
p6 <- ggplot(profile_data_oXY_E, aes(Length,value)) +
geom_line() +
ylim(0,10) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
# VARIANTE 3: PH AUF PLOT
p7 <- ggplot(profile_data_oXY_Ph, aes(Length,value, col=variable)) +
geom_point() +
stat_smooth()
# Separate plots
p8 <- ggplot(profile_data_oXY_Ph, aes(Length,value)) +
geom_line() +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5,scales = "free_y")
p9 <- ggplot(profile_data_oXY_Ph, aes(Length,value)) +
geom_line() +
ylim(0,10) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
# E und PH auf selben Plot
print(p1)
print(p2)
print(p3)
# E auf Plot
print(p4)
print(p5)
print(p6)
# PH auf Plot
print(p7)
print(p8)
print(p9)
# PH UND E AUF SELBEN PLOT a3 297 x 420
ggsave(filename="Plot1.pdf", plot = p1, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col.pdf", plot = p2, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col-10mYlim.pdf", plot = p3, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
# E AUF PLOT a3 297 x 420
ggsave(filename="Plot1_E.pdf", plot = p4, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col_E.pdf", plot = p5, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col-10mYlim_E.pdf", plot = p6, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
# PH AUF PLOT a3 297 x 420
ggsave(filename="Plot1_Ph.pdf", plot = p7, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col_Ph.pdf", plot = p8, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col-10mYlim_Ph.pdf", plot = p9, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
p6 <- ggplot(profile_data_oXY_E, aes(Length,value)) +
geom_line() +
ylim(0,300) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
p9 <- ggplot(profile_data_oXY_Ph, aes(Length,value)) +
geom_line() +
ylim(0,6) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
ggsave(filename="Plot2-5col-10mYlim_E.pdf", plot = p6, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col-10mYlim_Ph.pdf", plot = p9, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
p6 <- ggplot(profile_data_oXY_E, aes(Length,value)) +
geom_line() +
ylim(0,50) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
ggsave(filename="Plot2-5col-10mYlim_E.pdf", plot = p6, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
View(profile_data)
Reach_keep = grep("Reach_", names(profile_data_oXY), value = T)
profile_data_oXY_Reach <- melt(profile_data_oXY, id.vars="Length", measure.vars=Reach_keep)
# VARIANTE 3: Reach Probability AUF PLOT
p10 <- ggplot(profile_data_oXY_Reach, aes(Length,value, col=variable)) +
geom_point() +
stat_smooth()
# Separate plots
p11 <- ggplot(profile_data_oXY_Reach, aes(Length,value)) +
geom_line() +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5,scales = "free_y")
p12 <- ggplot(profile_data_oXY_Reach, aes(Length,value)) +
geom_line() +
ylim(0,100) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
# Reach AUF PLOT a3 297 x 420
ggsave(filename="Plot1_Reach.pdf", plot = p10, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col_Reach.pdf", plot = p11, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col-10mYlim_Reach.pdf", plot = p12, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
View(p5)
Reach_keep = grep("Reach_", names(profile_data_oXY), value = T)
profile_data_oXY = profile_data[-2:-3] # remove X and Y (we dont want to plot them)
Reach_keep = grep("Reach_", names(profile_data_oXY), value = T)
profile_data_oXY_Reach <- melt(profile_data_oXY, id.vars="Length", measure.vars=Reach_keep)
# VARIANTE 3: Reach Probability AUF PLOT
p10 <- ggplot(profile_data_oXY_Reach, aes(Length,value, col=variable)) +
geom_point() +
stat_smooth()
# Separate plots
p11 <- ggplot(profile_data_oXY_Reach, aes(Length,value)) +
geom_line() +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5,scales = "free_y")
p12 <- ggplot(profile_data_oXY_Reach, aes(Length,value)) +
geom_line() +
ylim(0,100) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
# Reach AUF PLOT a3 297 x 420
ggsave(filename="Plot1_Reach.pdf", plot = p10, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col_Reach.pdf", plot = p11, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
ggsave(filename="Plot2-5col-10mYlim_Reach.pdf", plot = p12, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)
p12 <- ggplot(profile_data_oXY_Reach, aes(Length,value)) +
geom_line() +
ylim(0,12.5) +
#stat_smooth() +
facet_wrap(variable ~ .,ncol=5)
ggsave(filename="Plot2-5col-10mYlim_Reach.pdf", plot = p12, device = "pdf", path = outpath, scale = 1, width = 297, height = 420, units=c("mm"), dpi = 300)