forked from clvde/LastheniaDispersalModel2017
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
163 lines (163 loc) · 9.08 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
library(ggplot2)
#------------------
# CREATE DATA FRAME
#------------------
## Another way to organize the data for production of a heatmap
bi <- 3
maxgen_bi <- 5000
mingen_bi <- 100
maxgen <- 30000
mingen <- 5100
trait <- "Dispb"
traitfileloc <- paste("/Users/Courtney/Documents/Melbourne & Flaxman Labs/Simulation Results/Burn In ",bi," Trait Data/",sep="")
currentfile <- read.csv(paste(traitfileloc, trait, "_analyzed_Burn_In_",bi,"_Gen_",mingen_bi,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(mingen,currentfile)
bigdf <- currentfile
colnames(bigdf)[1] <- "Generation"
for (i in seq(from=mingen_bi+100, to=maxgen_bi, by=100)){
currentfile <- read.csv(paste(traitfileloc,trait,"_analyzed_Burn_In_",bi,"_Gen_",i,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(i,currentfile)
colnames(currentfile)[1] <- "Generation"
bigdf <- rbind(bigdf,currentfile)
}
#
traitfileloc <- paste("/Users/Courtney/Documents/Melbourne & Flaxman Labs/Simulation Results/Env Change ",bi," (v=0.01) Trait Data/",sep="")
for (i in seq(from=mingen, to=maxgen, by=100)){
currentfile <- read.csv(paste(traitfileloc,trait,"_analyzed_Env_Change_(v=0.01)_",bi,"_Gen_",i,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(i,currentfile)
colnames(currentfile)[1] <- "Generation"
bigdf <- rbind(bigdf,currentfile)
}
write.csv(bigdf,paste(traitfileloc,trait,"_BIandEnvChange(v=0.01)_",bi,"_for_heatmap.csv",sep=""))
bigdfsub <- bigdf[-dim(bigdf)[1],]
min(bigdfsub$Max)
b <- c(0.18,0.25,0.32)
ggplot(data = bigdfsub, aes(x = LocationBin, y = Generation)) + scale_fill_gradientn(limits = c(0.18,0.32), colours=c("#0072ff", "white", "#ff0000"), breaks=b, labels=format(b)) +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_rect(fill = "black"), axis.line = element_line(colour = "black")) + geom_raster(aes(fill = Mean))
library(ggplot2)
#------------------
# CREATE DATA FRAME
#------------------
## Another way to organize the data for production of a heatmap
bi <- 3
maxgen_bi <- 5000
mingen_bi <- 100
maxgen <- 30000
mingen <- 5100
trait <- "Dispa"
traitfileloc <- paste("/Users/Courtney/Documents/Melbourne & Flaxman Labs/Simulation Results/Burn In ",bi," Trait Data/",sep="")
currentfile <- read.csv(paste(traitfileloc, trait, "_analyzed_Burn_In_",bi,"_Gen_",mingen_bi,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(mingen,currentfile)
bigdf <- currentfile
colnames(bigdf)[1] <- "Generation"
for (i in seq(from=mingen_bi+100, to=maxgen_bi, by=100)){
currentfile <- read.csv(paste(traitfileloc,trait,"_analyzed_Burn_In_",bi,"_Gen_",i,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(i,currentfile)
colnames(currentfile)[1] <- "Generation"
bigdf <- rbind(bigdf,currentfile)
}
#
traitfileloc <- paste("/Users/Courtney/Documents/Melbourne & Flaxman Labs/Simulation Results/Env Change ",bi," (v=0.01) Trait Data/",sep="")
for (i in seq(from=mingen, to=maxgen, by=100)){
currentfile <- read.csv(paste(traitfileloc,trait,"_analyzed_Env_Change_(v=0.01)_",bi,"_Gen_",i,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(i,currentfile)
colnames(currentfile)[1] <- "Generation"
bigdf <- rbind(bigdf,currentfile)
}
write.csv(bigdf,paste(traitfileloc,trait,"_BIandEnvChange(v=0.01)_",bi,"_for_heatmap.csv",sep=""))
bigdfsub <- bigdf[-dim(bigdf)[1],]
min(bigdfsub$Max)
max(bigdfsub$Max)
b <- c(0.22,0.27,0.32)
ggplot(data = bigdfsub, aes(x = LocationBin, y = Generation)) + scale_fill_gradientn(limits = c(0.22,0.32), colours=c("#0072ff", "white", "#ff0000"), breaks=b, labels=format(b)) +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_rect(fill = "black"), axis.line = element_line(colour = "black")) + geom_raster(aes(fill = Mean))
b <- c(0.18,0.25,0.32)
ggplot(data = bigdfsub, aes(x = LocationBin, y = Generation)) + scale_fill_gradientn(limits = c(0.18,0.32), colours=c("#0072ff", "white", "#ff0000"), breaks=b, labels=format(b)) +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_rect(fill = "black"), axis.line = element_line(colour = "black")) + geom_raster(aes(fill = Mean))
b <- c(0.17,0.25,0.33)
ggplot(data = bigdfsub, aes(x = LocationBin, y = Generation)) + scale_fill_gradientn(limits = c(0.18,0.32), colours=c("#0072ff", "white", "#ff0000"), breaks=b, labels=format(b)) +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_rect(fill = "black"), axis.line = element_line(colour = "black")) + geom_raster(aes(fill = Mean))
ggplot(data = bigdfsub, aes(x = LocationBin, y = Generation)) + scale_fill_gradientn(limits = c(0.17,0.33), colours=c("#0072ff", "white", "#ff0000"), breaks=b, labels=format(b)) +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_rect(fill = "black"), axis.line = element_line(colour = "black")) + geom_raster(aes(fill = Mean))
library(ggplot2)
#------------------
# CREATE DATA FRAME
#------------------
## Another way to organize the data for production of a heatmap
bi <- 3
maxgen_bi <- 5000
mingen_bi <- 100
maxgen <- 30000
mingen <- 5100
trait <- "Dispb"
traitfileloc <- paste("/Users/Courtney/Documents/Melbourne & Flaxman Labs/Simulation Results/Burn In ",bi," Trait Data/",sep="")
currentfile <- read.csv(paste(traitfileloc, trait, "_analyzed_Burn_In_",bi,"_Gen_",mingen_bi,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(mingen,currentfile)
bigdf <- currentfile
colnames(bigdf)[1] <- "Generation"
for (i in seq(from=mingen_bi+100, to=maxgen_bi, by=100)){
currentfile <- read.csv(paste(traitfileloc,trait,"_analyzed_Burn_In_",bi,"_Gen_",i,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(i,currentfile)
colnames(currentfile)[1] <- "Generation"
bigdf <- rbind(bigdf,currentfile)
}
#
traitfileloc <- paste("/Users/Courtney/Documents/Melbourne & Flaxman Labs/Simulation Results/Env Change ",bi," (v=0.01) Trait Data/",sep="")
for (i in seq(from=mingen, to=maxgen, by=100)){
currentfile <- read.csv(paste(traitfileloc,trait,"_analyzed_Env_Change_(v=0.01)_",bi,"_Gen_",i,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(i,currentfile)
colnames(currentfile)[1] <- "Generation"
bigdf <- rbind(bigdf,currentfile)
}
write.csv(bigdf,paste(traitfileloc,trait,"_BIandEnvChange(v=0.01)_",bi,"_for_heatmap.csv",sep=""))
bigdfsub <- bigdf[-dim(bigdf)[1],]
min(bigdfsub$Max)
max(bigdfsub$Max)
b <- c(0.95,1,1.05)
ggplot(data = bigdfsub, aes(x = LocationBin, y = Generation)) + scale_fill_gradientn(limits = c(0.95,1.05), colours=c("#0072ff", "white", "#ff0000"), breaks=b, labels=format(b)) +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_rect(fill = "black"), axis.line = element_line(colour = "black")) + geom_raster(aes(fill = Mean))
library(ggplot2)
#------------------
# CREATE DATA FRAME
#------------------
## Another way to organize the data for production of a heatmap
bi <- 3
maxgen_bi <- 5000
mingen_bi <- 100
maxgen <- 30000
mingen <- 5100
trait <- "Env"
traitfileloc <- paste("/Users/Courtney/Documents/Melbourne & Flaxman Labs/Simulation Results/Burn In ",bi," Trait Data/",sep="")
currentfile <- read.csv(paste(traitfileloc, trait, "_analyzed_Burn_In_",bi,"_Gen_",mingen_bi,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(mingen,currentfile)
bigdf <- currentfile
colnames(bigdf)[1] <- "Generation"
for (i in seq(from=mingen_bi+100, to=maxgen_bi, by=100)){
currentfile <- read.csv(paste(traitfileloc,trait,"_analyzed_Burn_In_",bi,"_Gen_",i,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(i,currentfile)
colnames(currentfile)[1] <- "Generation"
bigdf <- rbind(bigdf,currentfile)
}
#
traitfileloc <- paste("/Users/Courtney/Documents/Melbourne & Flaxman Labs/Simulation Results/Env Change ",bi," (v=0.01) Trait Data/",sep="")
for (i in seq(from=mingen, to=maxgen, by=100)){
currentfile <- read.csv(paste(traitfileloc,trait,"_analyzed_Env_Change_(v=0.01)_",bi,"_Gen_",i,".csv", sep=""))
currentfile <- currentfile[,-1]
currentfile <- cbind(i,currentfile)
colnames(currentfile)[1] <- "Generation"
bigdf <- rbind(bigdf,currentfile)
}
write.csv(bigdf,paste(traitfileloc,trait,"_BIandEnvChange(v=0.01)_",bi,"_for_heatmap.csv",sep=""))
bigdfsub <- bigdf[-dim(bigdf)[1],]
min(bigdfsub$Max)
max(bigdfsub$Max)
ggplot(data = bigdfsub, aes(x = LocationBin, y = Generation)) + scale_fill_gradientn(limits = c(-1.06,-0.94), colours=c("#0072ff", "white", "#ff0000"), breaks=b, labels=format(b)) +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_rect(fill = "black"), axis.line = element_line(colour = "black")) + geom_raster(aes(fill = Mean))
min(bigdfsub$Max)
max(bigdfsub$Max)
b <- c(-1.06,-1,-0.94)
ggplot(data = bigdfsub, aes(x = LocationBin, y = Generation)) + scale_fill_gradientn(limits = c(-1.06,-0.94), colours=c("#0072ff", "white", "#ff0000"), breaks=b, labels=format(b)) +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_rect(fill = "black"), axis.line = element_line(colour = "black")) + geom_raster(aes(fill = Mean))