-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_plots.r
169 lines (135 loc) · 6.84 KB
/
make_plots.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
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
#------------------------------------------------------------------------
#TS plots for paper
#------------------------------------------------------------------------
#Relative error in biomass trajectories
#length and age data--estimating growth
#----------------------------
#hake
g <- plot_ts_lines(hake.l, y = 'value', vert = 'data.amount',
horiz = 'g.desc', print = TRUE, rel = TRUE)+ labs(x = 'year',
y = 'relativer error in SSB', title = 'Hake -- A + L')
ggsave('results_figures/hake_a_l_ssb.png', g)
#yelloweye
g <- plot_ts_lines(yellow.l, y = 'value', vert = 'data.amount',
horiz = 'g.desc', print = TRUE, rel = TRUE) + labs(x = 'year',
y = 'relativer error in SSB', title = 'Yelloweye -- A + L')
ggsave('results_figures/yellow_a_l_ssb.png', g)
#weight at age
#----------------------------
#hake
g <- plot_ts_lines(hake.w, y = 'value', vert = 'data.amount',
horiz = 'g.desc', print = TRUE, rel = TRUE) + labs(x = 'year',
y = 'relativer error in SSB', title = 'Hake -- WtAtAge')
ggsave('results_figures/hake_wtatage_ssb.png', g)
#yelloweye
g <- plot_ts_lines(yellow.w, y = 'value', vert = 'data.amount',
horiz = 'g.desc', print = TRUE, rel = TRUE) + labs(x = 'year',
y = 'relativer error in SSB', title = 'Yelloweye -- WtAtAge')
ggsave('results_figures/yellow_wtatage_ssb.png', g)
#------------------------------------------------------------------------
#MARE Plots
#----------------------------------------
#Hake
g <- plot_scalar_boxplot(data = hake, x = 'data.desc', y = 'mare',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + theme_bw() + labs(x = 'year', y = 'MARE',
title = 'Hake')
ggsave('results_figures/hake_mare.png', g)
#Yelloweye
g <- plot_scalar_boxplot(data = yellow, x = 'data.desc', y = 'mare',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'MARE',
title = 'Yelloweye') + theme_bw()
ggsave('results_figures/yellow_mare.png', g)
#------------------------------------------------------------------------
#MRE Plots
g <- plot_scalar_boxplot(data = hake, x = 'data.desc', y = 'mre',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + theme_bw() + labs(x = 'year', y = 'MRE',
title = 'Hake')
ggsave('results_figures/hake_mre.png', g)
g <- plot_scalar_boxplot(data = yellow, x = 'data.desc', y = 'mre',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'MRE',
title = 'Yelloweye') + theme_bw()
ggsave('results_figures/yellow_mre.png', g)
#------------------------------------------------------------------------
#average relative error in ssb of last 50 years
#hake
g <- plot_scalar_boxplot(data = hake, x = 'data.desc', y = 'last.50.b_re',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'relative error in last 50 years ssb',
title = 'hake') + theme_bw()
ggsave('results_figures/hake_last50_ssb.png', g)
#yelloweye
g <- plot_scalar_boxplot(data = yellow, x = 'data.desc', y = 'last.50.b_re',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'relative error in last 50 years ssb',
title = 'yelloweye') + theme_bw()
ggsave('results_figures/yellow_last50_ssb.png', g)
#------------------------------------------------------------------------
#End year biomass (maybe supplementary figures)
g <- plot_scalar_boxplot(data = hake, x = 'data.desc', y = 'end.b_re',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'relative error in end year ssb',
title = 'hake') + theme_bw()
ggsave('results_figures/hake_end_ssb.png', g)
g <- plot_scalar_boxplot(data = yellow, x = 'data.desc', y = 'end.b_re',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'relative error in end year ssb',
title = 'yelloweye') + theme_bw()
ggsave('results_figures/yellow_end_ssb.png', g)
#------------------------------------------------------------------------
#last 10 year relative errors (supplementary figures?)
g <- plot_scalar_boxplot(data = hake, x = 'data.desc', y = 'last.10.b_re',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'relative error in last 10 year ssb',
title = 'hake') + theme_bw()
ggsave('results_figures/hake_last10_ssb.png', g)
g <- plot_scalar_boxplot(data = yellow, x = 'data.desc', y = 'last.10.b_re',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'relative error in last 10 year ssb',
title = 'yelloweye') + theme_bw()
ggsave('results_figures/yellow_last10_ssb.png', g)
#------------------------------------------------------------------------
#last 25 year relative errors (supplemntary figures?)
g <- plot_scalar_boxplot(data = hake, x = 'data.desc', y = 'last.25.b_re',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'relative error in last 25 year ssb',
title = 'hake') + theme_bw()
ggsave('results_figures/hake_last25_ssb.png', g)
g <- plot_scalar_boxplot(data = yellow, x = 'data.desc', y = 'last.25.b_re',
vert = 'data.amount', horiz = 'g.desc', print = TRUE,
rel = TRUE) + labs(x = 'data type', y = 'relative error in last 25 year ssb',
title = 'yelloweye') + theme_bw()
ggsave('results_figures/yellow_last25_ssb.png', g)
#--------------------------------------------------------------------------------
#Exploratory plots that are not saved
#--------------------------------------------------------------------------------
#Check growth variation in models
g <- plot_ts_lines(checks.e, y = 'value', vert = 'data.amount',
horiz = 'G', horiz2 = 'species', print = TRUE, rel = TRUE) + labs(x = 'year',
y = 'relativer error in SSB', title = 'Hake -- WtAtAge')
g <- plot_ts_lines(checks.x, y = 'value', vert = 'data.amount',
horiz = 'G', horiz2 = 'species', print = TRUE, rel = TRUE) + labs(x = 'year',
y = 'relativer error in SSB', title = 'Hake -- WtAtAge')
# ggsave('results_figures/hake_wtatage_ssb.png', g)
#----------------------------------------
##SSB Shit only from time invariant cases
#Estimated well across scenarios
g <- plot_scalar_boxplot(data = subset(results.sc.long.management,
variable == "SSB_MSY"), x = 'data.desc', y = 'value',
vert = 'data.amount', horiz = 'g.desc', print = TRUE)
source('TS_plots_for_paper2.R')
#Biomass trajectories
# g <- plot_ts_lines
# #Make Plots
# g <- plot_ts_lines(ssb.ts.e, y = 'value', vert = 'D',
# horiz = 'G', horiz2 = 'species', rel = TRUE, color = 'log_max_grad',
# print = TRUE)
# ggsave("figs/b_re_length_comps.png", g, width = width, height = height)
# g <- plot_ts_lines(ssb.ts.x, y = 'value', vert = 'X',
# horiz = 'G', horiz2 = 'species', rel = TRUE, color = 'log_max_grad',
# print = TRUE)
# ggsave("figs/b_re_wtatage.png", g, width = width, height = height)
# plot_sampled_wtatage(scenarios[1])