-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
167 lines (167 loc) · 6.02 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
seawater_survey2016 <- read_excel("http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx")
library(readxl)
seawater_survey2016 <- read_excel("http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx")
seawater_survey2016 <- read_excel("http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx")
seawater_survey2016 <- read_excel("http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx")
seawater_survey2016 <- read_excel("http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx")
#Load the dataset
GET(url1="http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx", write_disk(seawater_survey2016 <- tempfile(fileext = ".xlsx")))
library(httr)
#Load the dataset
GET(url1="http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx", write_disk(seawater_survey2016 <- tempfile(fileext = ".xlsx")))
library(httr)
#Load the dataset
GET(url1="http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx", write_disk(tf <- tempfile(fileext = ".xlsx")))
GET(url1="http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx")
GET(url1="http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx", write_disk(tf <- tempfile(fileext = ".xls")))
library(openxlsx)
seawater_survey2016 <- read_excel("http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx")
seawater_survey2016 <- read_excel("http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx")
seawater_survey2016 <- read.xlsx("http://dsfp.chem.uoa.gr/BlackSea/Y2016/Dataset_Y2016_map%20data.xlsx")
seawater_survey2016
#Selection of sampling year
areas <- as.data.frame(seawater_survey2016)
selected_year <- "2016"
#Define functions
mefilled.contour <- function(x = seq(0, 1, length.out = nrow(z)),
y = seq(0, 1, length.out = ncol(z)),
z,
xlim = range(x, finite = TRUE),
ylim = range(y, finite = TRUE),
zlim = range(z, finite = TRUE),
levels = pretty(zlim, nlevels),
nlevels = 20,
color.palette = cm.colors,
col = color.palette(length(levels) - 1),
plot.title,
plot.axes,
key.title,
key.axes,
asp = NA,
xaxs = "i",
yaxs = "i",
las = 1,
axes = TRUE,
frame.plot = axes, ...){
if (missing(z)) {
if (!missing(x)) {
if (is.list(x)) {
z <- x$z
y <- x$y
x <- x$x
}
else {
z <- x
x <- seq.int(0, 1, length.out = nrow(z))
}
}
else stop("no 'z' matrix specified")
}
else if (is.list(x)) {
y <- x$y
x <- x$x
}
if (any(diff(x) <= 0) || any(diff(y) <= 0))
stop("increasing 'x' and 'y' values expected")
mar.orig <- (par.orig <- par(c("mar", "las", "mfrow")))$mar
on.exit(par(par.orig))
w <- (3 + mar.orig[2L]) * par("csi") * 2.54
par(las = las)
mar <- mar.orig
mar[4L] <- mar[2L]
mar[2L] <- 1
plot.new()
if (missing(key.axes)) {
if (axes)
print(1)
}
else key.axes
if (!missing(key.title))
key.title
mar <- mar.orig
mar[4L] <- 1
par(mar = mar)
plot.window(xlim, ylim, "", xaxs = xaxs, yaxs = yaxs, asp = asp)
.filled.contour(x, y, z, levels, col)
if (missing(plot.axes)) {
if (axes) {
title(main = "", xlab = "", ylab = "")
Axis(x, side = 1)
Axis(y, side = 2)
}
}
else plot.axes
if (frame.plot)
box()
if (missing(plot.title))
title(...)
else plot.title
invisible()
}
plotMapPoints<-function(area=area,
xlim=c(19.5,29.5),
ylim=c(34.8,41.8),
col="grey60",
fill=T,
type ="p",
col_points="red",cex=0.5,
plotclr=c("pink1","red", "red4","black"),
symbol.size=1.1){
library(gstat)
library(mgcv)
library(maps)
library(mapdata)
library(RColorBrewer)
library(akima)
library(maptools)
library(classInt)
library(scales)
min(area$Abundance)
max(area$Abundance)
min(log(area$Abundance))
max(log(area$Abundance))
plotvar <- area$Abundance
plotclr<-plotclr
nclr <- length(plotclr)
class <- classIntervals(plotvar, n=nclr, style="quantile")
class
colcode <- findColours(class, plotclr)
map(database = "world", xlim=xlim, ylim = ylim, resolution = 0, col=col, fill=fill,bg="white",
xlab="Longitude",ylab="Latitude")
map.axes()
points(area$LON, area$LAT, pch=16, type="p",col=colcode,cex=symbol.size,xlab="Longitude",ylab="Latitude")
legend<-names(attr(colcode, "table"))
text(34.5,41,"Turkey", cex = 1)
text(29.7,46.2,"Ukraine", cex = 1)
text(40.5,45.0,"Russia", cex = 1)
text(42.4,42.4,"Georgia", cex = 1)
text(27.7,43.6,"Bulgaria", cex = 1)
text(27.8,44.6,"Romania", cex = 1)
text(29,45.18,"Danube", cex = 2.0,font=2, col="#ADD8E6")
}
ylim=c(44,47)
xlim=c(27,34)
pred.points<-rbind(
cbind(x=seq(from=29,to=30,length.out=length(seq(from=44.7, to=45.5,by=0.01))),seq(from=44.7, to=45.5,by=0.01)),
cbind(x=seq(from=29,to=30,length.out=length(rev(seq(from=44.7, to=45.5,by=0.01)))),rev(seq(from=44.7, to=45.5,by=0.01))),
cbind(x=seq(from=30,to=31,length.out=length(seq(from=44, to=44.5,by=0.01))),seq(from=44, to=44.5,by=0.01)),
cbind(x=seq(from=30,to=31,length.out=length(rev(seq(from=44, to=44.5,by=0.01)))),rev(seq(from=44, to=44.5,by=0.01))),
cbind(x=seq(from=31,to=32,length.out=length(seq(from=44, to=47,by=0.01))),seq(from=44, to=47,by=0.01)),
cbind(x=seq(from=31,to=32,length.out=length(rev(seq(from=44, to=47,by=0.01)))),rev(seq(from=44, to=47,by=0.01))),
cbind(x=seq(from=32,to=33,length.out=length(seq(from=44, to=45,by=0.01))),seq(from=44, to=45,by=0.01)),
cbind(x=seq(from=32,to=33,length.out=length(rev(seq(from=44, to=45,by=0.01)))),rev(seq(from=44, to=45,by=0.01))),
cbind(x=seq(from=33,to=34,length.out=length(seq(from=42.5, to=43,by=0.01))),seq(from=42.5, to=43,by=0.01)),
cbind(x=seq(from=33,to=34,length.out=length(rev(seq(from=42.5, to=43,by=0.01)))),rev(seq(from=42.5, to=43,by=0.01))),
cbind(x=seq(from=34,to=35,length.out=length(seq(from=42.5, to=43,by=0.01))),seq(from=42.5, to=43,by=0.01)),
cbind(x=seq(from=34,to=35,length.out=length(rev(seq(from=42.5, to=43,by=0.01)))),rev(seq(from=42.5, to=43,by=0.01))),
cbind(x=seq(from=35,to=36,length.out=length(seq(from=42.5, to=43,by=0.01))),seq(from=42.5, to=43,by=0.01)),
cbind(x=seq(from=35,to=36,length.out=length(rev(seq(from=42.5, to=43,by=0.01)))),rev(seq(from=42.5, to=43,by=0.01)))
)
pred.points<-as.data.frame(pred.points)
names(pred.points)<-c("LON","LAT")
#####1st figure (Point plot)-----
i<-6
area<-data.frame(LAT=as.numeric(areas[,2]),
LON=as.numeric(areas[,3]),
Abundance=as.numeric(areas[,c(i)]),
mzrt=names(areas)[c(i)])