This vignette describes the use of the mixfishtools package, which is used by WGMIXFISH for creating plot outputs for WGMIXFISH-ADVICE, Fisheries Overviews, and other associated dissemination products.
Most plotting function produce ggplot2
outputs, which
can be subsequently adapted to specific formatting needs; e.g.:
p <- plot_effortFltStk(data, refTable)
p <- p + theme(text = element_text(size = 12)) # adjust font size
print(p)
All examples are created from example data files included in the
mixfishtools package (e.g. stfFltSum
,
stfFltStkSum
, stfMtStkSum
). For brevity, only
the final prepared data structures necessary for the respective
functions are shown below, but the procedures to adapt the example data
to the final structures are illustrated in the respective help page
examples of each function (e.g. ?plot_catchScenStk
).
In order to install the most recent version, please install the package in one of the following ways:
# install pre-compiled package (preferred)
install.packages('mixfishtools', repo = 'https://ices-tools-prod.r-universe.dev')
# install from source
library(remotes)
install_github(repo = "ices-tools-dev/mixfishtools")
Then load the package:
A further package to read and embed the produced .png files:
The following section outlines the main plotting functions used for the mixed fisheries considerations documents from WGMIXFISH-ADVICE.
In the following example, we will prepare two objects to be passed to
the plotting function plot_catchScenStk
.
The first object, data
, is a data.frame
containing catches by scenario and stock in the advice year. The example
data stfFltStkSum
is aggregated across fleets to produce
this object, with variables named scenario
,
stock
, and catch
. The order of scenarios
should be specified by the order of levels in the factor variable
scenario
.
data
#> scenario stock catch
#> 1 cod-ns cod.27.47d20 14276.0000
#> 2 max cod.27.47d20 64648.4395
#> 3 min cod.27.47d20 14272.9385
#> 4 sq_E cod.27.47d20 33236.4900
#> 5 cod-ns had.27.46a20 61827.1233
#> 6 max had.27.46a20 358302.5477
#> 7 min had.27.46a20 61823.7003
#> 8 sq_E had.27.46a20 137789.9934
#> 9 cod-ns ple.27.7d 2149.6760
#> 10 max ple.27.7d 8879.5598
#> 11 min ple.27.7d 1971.2486
#> 12 sq_E ple.27.7d 4648.7073
#> 13 cod-ns ple.27.420 43856.1147
#> 14 max ple.27.420 209542.8390
#> 15 min ple.27.420 43212.3717
#> 16 sq_E ple.27.420 107729.5452
#> 17 cod-ns pok.27.3a46 29151.0208
#> 18 max pok.27.3a46 141641.9141
#> 19 min pok.27.3a46 29150.9649
#> 20 sq_E pok.27.3a46 67594.3270
#> 21 cod-ns sol.27.7d 1410.9367
#> 22 max sol.27.7d 5524.1252
#> 23 min sol.27.7d 1339.1967
#> 24 sq_E sol.27.7d 3138.4032
#> 25 cod-ns sol.27.4 6337.7235
#> 26 max sol.27.4 27433.6135
#> 27 min sol.27.4 6234.1303
#> 28 sq_E sol.27.4 15502.6061
#> 29 cod-ns tur.27.4 1311.2338
#> 30 max tur.27.4 5822.5151
#> 31 min tur.27.4 1283.3400
#> 32 sq_E tur.27.4 3238.6320
#> 33 cod-ns whg.27.47d 23340.5780
#> 34 max whg.27.47d 121076.7353
#> 35 min whg.27.47d 23047.2096
#> 36 sq_E whg.27.47d 53698.2425
#> 37 cod-ns wit.27.3a47d 987.0833
#> 38 max wit.27.3a47d 4382.1717
#> 39 min wit.27.3a47d 987.0225
#> 40 sq_E wit.27.3a47d 2315.3631
The second object, adv
, is a data.frame
containing the advised catch by stock. The expected variable names are
advice
by stock
. Optionally, the advice levels
associated with Fmsy upper (upper
) and Fmsy lower
(lower
) can be included. Where Fmsy upper or Fmsy lower
advice levels are not applicable, one should duplicate the advice levels
(e.g. no Fmsy upper advice is given for COD-NS given it’s poor status,
SSB < Btrigger, in the advice year, thus the advice and upper values
are the same).
adv
#> stock advice lower upper
#> 1 cod.27.47d20 14276 9701 14276
#> 2 had.27.46a20 128708 111702 128708
#> 3 ple.27.7d 6365 4594 6365
#> 4 ple.27.420 142507 101854 195622
#> 5 pok.27.3a46 49614 30204 49614
#> 6 sol.27.7d 1810 1068 2069
#> 7 sol.27.4 15330 9523 21805
#> 8 tur.27.4 3609 2634 4564
#> 9 whg.27.47d 88426 70169 91703
#> 10 wit.27.3a47d 1206 875 1206
The two objects are then passed to plot_catchScenStk
for
the final plot.
p <- plot_catchScenStk(data = data, adv = adv)
# print(p)
fname <- paste0(tempfile(), ".png")
png(fname, width = 6, height = 5, units = "in", res = 400)
print(p)
out <- dev.off()
tmp <- png::readPNG(fname)
knitr::include_graphics(fname, dpi = floor(dim(tmp)[2]/6))
See ?plot_catchScenStk
for further argument details.
Two main objects used by the plot_effortFltStk
function:
a data
object and a refTable
object containing
information on plotting colors for added consistency across several
subsequent plots.
The data
object contains the effort required for each
fleet
to take up it’s quota share
(quotaEffort
) of each stock
. In addition, the
status quo effort (sqEffort
) by fleet is provided for
reference. This should be each fleet’s respective effort used for the
intermediate year in the short-term forecast. Finally, The variable
Limitation
provides information on most- and least-limiting
stocks for each fleet (lowest and highest quotaEffort
,
respectively), while other stocks are designated with
NA
.
data[1:100,]
#> fleet stock catch Limitation quotaEffort
#> BE_Beam<24.1 BE_Beam<24 cod.27.47d20 1.179056e+00 most 387.6269
#> BE_Beam<24.2 BE_Beam<24 ple.27.420 6.442031e+01 <NA> 1070.3815
#> BE_Beam<24.3 BE_Beam<24 sol.27.4 1.166893e+02 <NA> 758.0842
#> BE_Beam<24.4 BE_Beam<24 tur.27.4 1.828944e+01 <NA> 853.8919
#> BE_Beam<24.5 BE_Beam<24 whg.27.47d 5.936659e+01 least 1443.4418
#> BE_Beam<24.6 BE_Beam<24 had.27.46a20 4.298913e-01 <NA> 934.5794
#> BE_Beam<24.7 BE_Beam<24 wit.27.3a47d 7.889361e-04 <NA> 397.8015
#> BE_Beam<24.8 BE_Beam<24 ple.27.7d 2.875940e+02 <NA> 1149.0560
#> BE_Beam<24.9 BE_Beam<24 sol.27.7d 1.314579e+02 <NA> 626.6679
#> BE_Beam>=24.10 BE_Beam>=24 cod.27.47d20 4.953274e+02 most 1187.8764
#> BE_Beam>=24.11 BE_Beam>=24 ple.27.420 1.632274e+03 <NA> 3138.1560
#> BE_Beam>=24.12 BE_Beam>=24 sol.27.4 1.103295e+02 <NA> 2080.3402
#> BE_Beam>=24.13 BE_Beam>=24 tur.27.4 4.653209e+01 <NA> 2615.7350
#> BE_Beam>=24.14 BE_Beam>=24 whg.27.47d 1.092357e+02 least 4607.2533
#> BE_Beam>=24.15 BE_Beam>=24 had.27.46a20 3.609378e+02 <NA> 2978.8633
#> BE_Beam>=24.16 BE_Beam>=24 wit.27.3a47d 7.436899e-01 <NA> 1325.4089
#> BE_Beam>=24.17 BE_Beam>=24 ple.27.7d 3.878179e+02 <NA> 3661.4269
#> BE_Beam>=24.18 BE_Beam>=24 sol.27.7d 2.837640e+02 <NA> 1996.8556
#> BE_Beam>=24.19 BE_Beam>=24 nep.27.4outFU 4.312228e-02 <NA> 1244.6315
#> BE_Beam>=24.20 BE_Beam>=24 pok.27.3a46 1.750230e+00 <NA> 2017.1735
#> BE_Beam>=24.21 BE_Beam>=24 nep.fu.5 9.500239e-01 <NA> 5448.1639
#> BE_DSeine.22 BE_DSeine cod.27.47d20 5.724904e+00 most 168.3932
#> BE_DSeine.23 BE_DSeine ple.27.420 2.737325e+00 <NA> 454.3631
#> BE_DSeine.24 BE_DSeine sol.27.4 1.458028e-02 <NA> 502.3729
#> BE_DSeine.25 BE_DSeine tur.27.4 2.317999e-01 <NA> 412.0771
#> BE_DSeine.26 BE_DSeine whg.27.47d 3.003627e+02 least 678.2435
#> BE_DSeine.27 BE_DSeine had.27.46a20 8.687189e+00 <NA> 370.4062
#> BE_DSeine.28 BE_DSeine ple.27.7d 3.294580e+00 <NA> 577.4168
#> BE_DSeine.29 BE_DSeine sol.27.7d 1.093434e+00 <NA> 323.2622
#> BE_DSeine.30 BE_DSeine nep.27.4outFU 4.331100e-04 <NA> 181.1031
#> BE_DSeine.31 BE_DSeine nep.fu.5 8.662201e-04 <NA> 792.7480
#> BE_Otter.32 BE_Otter cod.27.47d20 8.277466e+00 most 342.5315
#> BE_Otter.33 BE_Otter ple.27.420 1.207490e+03 <NA> 1024.1667
#> BE_Otter.34 BE_Otter sol.27.4 2.155300e+01 least 1569.6760
#> BE_Otter.35 BE_Otter tur.27.4 5.251125e+01 <NA> 672.8330
#> BE_Otter.36 BE_Otter whg.27.47d 9.037471e+01 <NA> 1355.5506
#> BE_Otter.37 BE_Otter had.27.46a20 1.953295e+00 <NA> 746.0409
#> BE_Otter.38 BE_Otter wit.27.3a47d 7.626900e+00 <NA> 429.8930
#> BE_Otter.39 BE_Otter ple.27.7d 7.332101e-01 <NA> 1169.9421
#> BE_Otter.40 BE_Otter sol.27.7d 4.802993e-01 <NA> 654.1410
#> BE_Otter.41 BE_Otter nep.27.4outFU 3.602729e+01 <NA> 366.5968
#> BE_Otter.42 BE_Otter nep.fu.5 8.231233e+01 <NA> 1604.7153
#> BE_Otter.43 BE_Otter nep.fu.33 1.729365e+02 <NA> 466.7474
#> DK_Otter<24.44 DK_Otter<24 cod.27.47d20 3.695135e+02 most 1180.8547
#> DK_Otter<24.45 DK_Otter<24 ple.27.420 7.919593e+02 <NA> 3515.3306
#> DK_Otter<24.46 DK_Otter<24 sol.27.4 2.189794e+00 <NA> 1741.3377
#> DK_Otter<24.47 DK_Otter<24 tur.27.4 1.657692e+01 <NA> 2696.2238
#> DK_Otter<24.48 DK_Otter<24 whg.27.47d 1.115906e+00 least 4604.7606
#> DK_Otter<24.49 DK_Otter<24 had.27.46a20 9.682296e+01 <NA> 3757.4292
#> DK_Otter<24.50 DK_Otter<24 wit.27.3a47d 1.361272e+02 <NA> 1453.8625
#> DK_Otter<24.51 DK_Otter<24 nep.27.4outFU 1.084372e-01 <NA> 1394.9233
#> DK_Otter<24.52 DK_Otter<24 pok.27.3a46 7.706498e+01 <NA> 2213.3965
#> DK_Otter<24.53 DK_Otter<24 nep.fu.33 4.580388e+00 <NA> 1776.0028
#> DK_Otter<24.54 DK_Otter<24 nep.fu.32 7.768048e-02 <NA> 6338.7448
#> DK_Otter>=24.55 DK_Otter>=24 cod.27.47d20 7.103478e+02 most 3231.8607
#> DK_Otter>=24.56 DK_Otter>=24 ple.27.420 1.045207e+03 <NA> 10657.0158
#> DK_Otter>=24.57 DK_Otter>=24 sol.27.4 5.680819e-01 <NA> 8343.1100
#> DK_Otter>=24.58 DK_Otter>=24 tur.27.4 3.108967e+01 <NA> 7792.8508
#> DK_Otter>=24.59 DK_Otter>=24 whg.27.47d 3.355962e+01 <NA> 13838.1292
#> DK_Otter>=24.60 DK_Otter>=24 had.27.46a20 6.461334e+02 <NA> 5912.5274
#> DK_Otter>=24.61 DK_Otter>=24 wit.27.3a47d 8.839463e+01 <NA> 5110.1026
#> DK_Otter>=24.62 DK_Otter>=24 nep.27.4outFU 4.565643e+00 <NA> 4180.8967
#> DK_Otter>=24.63 DK_Otter>=24 pok.27.3a46 5.836622e+02 <NA> 5607.1029
#> DK_Otter>=24.64 DK_Otter>=24 nep.fu.5 1.512279e-02 <NA> 18301.1684
#> DK_Otter>=24.65 DK_Otter>=24 nep.fu.33 9.647262e+00 <NA> 5323.0770
#> DK_Otter>=24.66 DK_Otter>=24 nep.fu.32 9.413939e+00 <NA> 18998.6334
#> DK_Otter>=24.67 DK_Otter>=24 nep.fu.7 1.394130e-01 least 23849.8950
#> DK_Seine.68 DK_Seine cod.27.47d20 4.799721e+02 most 444.2530
#> DK_Seine.69 DK_Seine ple.27.420 6.272085e+02 <NA> 1518.8601
#> DK_Seine.70 DK_Seine tur.27.4 8.809011e-01 <NA> 1229.4213
#> DK_Seine.71 DK_Seine whg.27.47d 8.770709e+00 least 2075.5311
#> DK_Seine.72 DK_Seine had.27.46a20 4.592894e+02 <NA> 870.4080
#> DK_Seine.73 DK_Seine wit.27.3a47d 2.304141e+01 <NA> 625.4041
#> DK_Seine.74 DK_Seine pok.27.3a46 1.065240e+02 <NA> 858.1055
#> DK_Seine.75 DK_Seine nep.fu.32 1.049308e-03 <NA> 2688.4440
#> DK_Static.76 DK_Static cod.27.47d20 3.345203e+02 most 531.6279
#> DK_Static.77 DK_Static ple.27.420 1.589533e+03 <NA> 1907.1600
#> DK_Static.78 DK_Static sol.27.4 8.283899e+01 <NA> 1245.8553
#> DK_Static.79 DK_Static tur.27.4 4.110168e+01 <NA> 1295.3499
#> DK_Static.80 DK_Static whg.27.47d 1.054132e-01 least 2468.9410
#> DK_Static.81 DK_Static had.27.46a20 1.443172e+01 <NA> 1459.5885
#> DK_Static.82 DK_Static wit.27.3a47d 7.270930e-01 <NA> 933.3173
#> DK_Static.83 DK_Static pok.27.3a46 3.693454e+00 <NA> 968.4708
#> EN_<10.84 EN_<10 cod.27.47d20 3.292122e+01 most 1519.2698
#> EN_<10.85 EN_<10 ple.27.420 1.806009e+01 <NA> 4481.9188
#> EN_<10.86 EN_<10 sol.27.4 7.202350e+01 <NA> 2834.4725
#> EN_<10.87 EN_<10 tur.27.4 9.148208e+00 <NA> 3440.8423
#> EN_<10.88 EN_<10 whg.27.47d 1.124004e+02 least 5949.0598
#> EN_<10.89 EN_<10 had.27.46a20 7.405011e+00 <NA> 5330.6793
#> EN_<10.90 EN_<10 wit.27.3a47d 1.033674e-01 <NA> 1708.1691
#> EN_<10.91 EN_<10 ple.27.7d 1.435929e+02 <NA> 4622.7926
#> EN_<10.92 EN_<10 sol.27.7d 8.776409e+01 <NA> 2595.4147
#> EN_<10.93 EN_<10 nep.27.4outFU 3.506647e-01 <NA> 1592.2798
#> EN_<10.94 EN_<10 pok.27.3a46 9.714586e-02 <NA> 2638.2537
#> EN_<10.95 EN_<10 nep.fu.6 2.160037e+02 <NA> 2982.1354
#> EN_Beam.96 EN_Beam cod.27.47d20 3.769180e+00 <NA> 863.8068
#> EN_Beam.97 EN_Beam ple.27.420 9.192679e+02 <NA> 2844.5124
#> EN_Beam.98 EN_Beam sol.27.4 1.477561e+02 <NA> 2133.9309
#> EN_Beam.99 EN_Beam tur.27.4 3.989833e+01 <NA> 2174.7579
#> EN_Beam.100 EN_Beam whg.27.47d 2.914816e+01 least 2919.5314
#> sqEffort
#> BE_Beam<24.1 838.556
#> BE_Beam<24.2 838.556
#> BE_Beam<24.3 838.556
#> BE_Beam<24.4 838.556
#> BE_Beam<24.5 838.556
#> BE_Beam<24.6 838.556
#> BE_Beam<24.7 838.556
#> BE_Beam<24.8 838.556
#> BE_Beam<24.9 838.556
#> BE_Beam>=24.10 2672.029
#> BE_Beam>=24.11 2672.029
#> BE_Beam>=24.12 2672.029
#> BE_Beam>=24.13 2672.029
#> BE_Beam>=24.14 2672.029
#> BE_Beam>=24.15 2672.029
#> BE_Beam>=24.16 2672.029
#> BE_Beam>=24.17 2672.029
#> BE_Beam>=24.18 2672.029
#> BE_Beam>=24.19 2672.029
#> BE_Beam>=24.20 2672.029
#> BE_Beam>=24.21 2672.029
#> BE_DSeine.22 388.800
#> BE_DSeine.23 388.800
#> BE_DSeine.24 388.800
#> BE_DSeine.25 388.800
#> BE_DSeine.26 388.800
#> BE_DSeine.27 388.800
#> BE_DSeine.28 388.800
#> BE_DSeine.29 388.800
#> BE_DSeine.30 388.800
#> BE_DSeine.31 388.800
#> BE_Otter.32 787.026
#> BE_Otter.33 787.026
#> BE_Otter.34 787.026
#> BE_Otter.35 787.026
#> BE_Otter.36 787.026
#> BE_Otter.37 787.026
#> BE_Otter.38 787.026
#> BE_Otter.39 787.026
#> BE_Otter.40 787.026
#> BE_Otter.41 787.026
#> BE_Otter.42 787.026
#> BE_Otter.43 787.026
#> DK_Otter<24.44 2994.683
#> DK_Otter<24.45 2994.683
#> DK_Otter<24.46 2994.683
#> DK_Otter<24.47 2994.683
#> DK_Otter<24.48 2994.683
#> DK_Otter<24.49 2994.683
#> DK_Otter<24.50 2994.683
#> DK_Otter<24.51 2994.683
#> DK_Otter<24.52 2994.683
#> DK_Otter<24.53 2994.683
#> DK_Otter<24.54 2994.683
#> DK_Otter>=24.55 8975.732
#> DK_Otter>=24.56 8975.732
#> DK_Otter>=24.57 8975.732
#> DK_Otter>=24.58 8975.732
#> DK_Otter>=24.59 8975.732
#> DK_Otter>=24.60 8975.732
#> DK_Otter>=24.61 8975.732
#> DK_Otter>=24.62 8975.732
#> DK_Otter>=24.63 8975.732
#> DK_Otter>=24.64 8975.732
#> DK_Otter>=24.65 8975.732
#> DK_Otter>=24.66 8975.732
#> DK_Otter>=24.67 8975.732
#> DK_Seine.68 1270.131
#> DK_Seine.69 1270.131
#> DK_Seine.70 1270.131
#> DK_Seine.71 1270.131
#> DK_Seine.72 1270.131
#> DK_Seine.73 1270.131
#> DK_Seine.74 1270.131
#> DK_Seine.75 1270.131
#> DK_Static.76 1488.401
#> DK_Static.77 1488.401
#> DK_Static.78 1488.401
#> DK_Static.79 1488.401
#> DK_Static.80 1488.401
#> DK_Static.81 1488.401
#> DK_Static.82 1488.401
#> DK_Static.83 1488.401
#> EN_<10.84 3418.376
#> EN_<10.85 3418.376
#> EN_<10.86 3418.376
#> EN_<10.87 3418.376
#> EN_<10.88 3418.376
#> EN_<10.89 3418.376
#> EN_<10.90 3418.376
#> EN_<10.91 3418.376
#> EN_<10.92 3418.376
#> EN_<10.93 3418.376
#> EN_<10.94 3418.376
#> EN_<10.95 3418.376
#> EN_Beam.96 2079.838
#> EN_Beam.97 2079.838
#> EN_Beam.98 2079.838
#> EN_Beam.99 2079.838
#> EN_Beam.100 2079.838
The reference table (refTable
) provides information on
plotting order
, and color
, used by many
subsequent plots to maintain consistent presentation. The variable
stock
should contain the ICES stock codes, which are used
in through in advice documents. In this example, the optional column
stock_short
is used as a look-up name to replace the
shortened stock names used in the North Sea mixed fishery model with the
ICES stock codes. A couple non-standard stocks have been added to the
North Sea refTable
(“nep.fu6-9”, “Nephrops”) as several
plots end up grouping Nephrops function units (FUs) for
simplicity. Similar adjustments may exist for other case studies, and
the refTable
can be adjusted accordingly.
data("refTable")
refTable
#> stock order col stock_short
#> 1 cod.27.47d20 1 #a6cee3 COD-NS
#> 2 had.27.46a20 2 #1f78b4 HAD
#> 13 ple.27.7d 3 #b2df8a PLE-EC
#> 14 ple.27.420 4 #33a02c PLE-NS
#> 15 pok.27.3a46 5 #fb9a99 POK
#> 16 sol.27.7d 6 #e31a1c SOL-EC
#> 17 sol.27.4 7 #fdbf6f SOL-NS
#> 18 tur.27.4 8 #ff7f00 TUR
#> 19 whg.27.47d 9 #cab2d6 WHG-NS
#> 20 wit.27.3a47d 10 #6a3d9a WIT
#> 3 nep.fu.5 11 #333333 NEP5
#> 4 nep.fu.6 12 #464646 NEP6
#> 5 nep.fu.7 13 #5A5A5A NEP7
#> 6 nep.fu.8 14 #6E6E6E NEP8
#> 7 nep.fu.9 15 #828282 NEP9
#> 8 nep.fu.10 16 #959595 NEP10
#> 9 nep.fu.32 17 #A9A9A9 NEP32
#> 10 nep.fu.33 18 #BDBDBD NEP33
#> 11 nep.fu.34 19 #D1D1D1 NEP34
#> 12 nep.27.4outFU 20 #E5E5E5 NEPOTH-NS
#> 21 nep.fu6-9 21 #ffff99 NEP6-9
#> 211 Nephrops 22 #ffff99 Nephrops
The two objects are then passed to plot_effortFltStk
for
the final plot.
The typical pie-chart showing historical (observed) landings or
catches by stock in the final data year can be produced with
plot_landByStock
. The function again requires a
data
object and the refTable
look-up table for
colors to be used by stock. The data
object contains a
stock
variable and a value
variable with
either observed landings (typical) or catches (define label with
ylab
).
data
#> stock value
#> 1 cod.27.47d20 19371.915
#> 2 had.27.46a20 31476.235
#> 13 ple.27.7d 2092.831
#> 14 ple.27.420 44068.052
#> 15 pok.27.3a46 73790.988
#> 16 sol.27.7d 2370.934
#> 17 sol.27.4 9376.151
#> 18 tur.27.4 3248.993
#> 19 whg.27.47d 19756.056
#> 20 wit.27.3a47d 1979.665
#> 11 Nephrops 15250.733
The last standard plot (plot_landByMetStock
) shows the
historical (observed) landings or catches by stock and metier in the
final data year. The function again requires a data
object
and the refTable
look-up table for colors to be used by
stock. The data
object contains a stock
and
metier
variables, as well as a value
variable
with either observed landings (typical) or catches (define label with
ylab
). Note that the definition of metier
categories is not standardised and each case study may choose to use a
different definition.
data
#> stock metier value
#> 1 cod.27.47d20 BT1 744.27870
#> 2 had.27.46a20 BT1 58.68670
#> 3 Nephrops BT1 2.05150
#> 4 ple.27.420 BT1 10170.55930
#> 5 pok.27.3a46 BT1 15.20510
#> 6 sol.27.4 BT1 97.46770
#> 7 tur.27.4 BT1 246.80620
#> 8 whg.27.47d BT1 16.78890
#> 9 wit.27.3a47d BT1 51.95140
#> 10 cod.27.47d20 BT2 102.14516
#> 11 had.27.46a20 BT2 3.46190
#> 12 Nephrops BT2 7.60999
#> 13 ple.27.7d BT2 684.20654
#> 14 ple.27.420 BT2 10007.55678
#> 15 pok.27.3a46 BT2 0.09000
#> 16 sol.27.7d BT2 740.25384
#> 17 sol.27.4 BT2 8332.23132
#> 18 tur.27.4 BT2 1932.30031
#> 19 whg.27.47d BT2 277.96190
#> 20 wit.27.3a47d BT2 1.31054
#> 21 cod.27.47d20 GN1 482.64398
#> 22 had.27.46a20 GN1 10.77983
#> 23 Nephrops GN1 3.86350
#> 24 ple.27.7d GN1 95.39665
#> 25 ple.27.420 GN1 2718.80983
#> 26 pok.27.3a46 GN1 11.46595
#> 27 sol.27.7d GN1 89.66842
#> 28 sol.27.4 GN1 163.77813
#> 29 tur.27.4 GN1 112.32582
#> 30 whg.27.47d GN1 5.48200
#> 31 wit.27.3a47d GN1 2.05656
#> 32 cod.27.47d20 GT1 6.82650
#> 33 had.27.46a20 GT1 0.00030
#> 34 ple.27.7d GT1 109.66399
#> 35 sol.27.7d GT1 344.47170
#> 36 tur.27.4 GT1 3.99890
#> 37 whg.27.47d GT1 0.69000
#> 38 cod.27.47d20 LL1 104.54980
#> 39 had.27.46a20 LL1 14.98040
#> 40 ple.27.420 LL1 1.12650
#> 41 pok.27.3a46 LL1 40.05400
#> 42 tur.27.4 LL1 0.06650
#> 43 whg.27.47d LL1 6.71710
#> 50 cod.27.47d20 OTH 5107.84444
#> 51 had.27.46a20 OTH 7327.31393
#> 52 Nephrops OTH 1711.54994
#> 53 ple.27.7d OTH 449.87977
#> 54 ple.27.420 OTH 8390.11742
#> 55 pok.27.3a46 OTH 43341.85255
#> 56 sol.27.7d OTH 691.43832
#> 57 sol.27.4 OTH 638.24097
#> 58 tur.27.4 OTH 77.58067
#> 59 whg.27.47d OTH 4262.93221
#> 60 wit.27.3a47d OTH 536.17815
#> 61 cod.27.47d20 TR1 12175.42428
#> 62 had.27.46a20 TR1 23638.55985
#> 63 Nephrops TR1 7093.67235
#> 64 ple.27.420 TR1 9741.04041
#> 65 pok.27.3a46 TR1 29966.38202
#> 66 sol.27.4 TR1 7.72505
#> 67 tur.27.4 TR1 566.60270
#> 68 whg.27.47d TR1 11778.27679
#> 69 wit.27.3a47d TR1 981.19961
#> 70 cod.27.47d20 TR2 603.42540
#> 71 had.27.46a20 TR2 319.83432
#> 72 Nephrops TR2 5516.85542
#> 73 ple.27.7d TR2 741.83026
#> 74 ple.27.420 TR2 2132.85686
#> 75 pok.27.3a46 TR2 357.06575
#> 76 sol.27.7d TR2 505.00696
#> 77 sol.27.4 TR2 93.13759
#> 78 tur.27.4 TR2 224.28955
#> 79 whg.27.47d TR2 2755.46404
#> 80 wit.27.3a47d TR2 399.10889
#> 91 cod.27.47d20 beam_oth 0.56070
#> 92 ple.27.420 beam_oth 19.79692
#> 93 sol.27.4 beam_oth 33.75823
#> 94 tur.27.4 beam_oth 3.79171
#> 95 whg.27.47d beam_oth 18.93500
#> 112 cod.27.47d20 pots 23.39450
#> 113 had.27.46a20 pots 0.61400
#> 114 Nephrops pots 386.76190
#> 115 ple.27.7d pots 0.15910
#> 116 ple.27.420 pots 0.52340
#> 117 pok.27.3a46 pots 0.09450
#> 118 sol.27.7d pots 0.04080
#> 119 sol.27.4 pots 1.08200
#> 120 tur.27.4 pots 1.14790
#> 121 whg.27.47d pots 5.62990
#> 122 wit.27.3a47d pots 0.04350
The mixfishtools package contains several other plotting functions that may be used in the accompanying advice report, but are not yet included in the advice document.
data[1:100,]
#> scenario year fleet metier stock iter landings
#> 1 min 2014 BE_Beam<24 beam_oth.4 cod.27.47d20 1 4.3790000
#> 2 min 2015 BE_Beam<24 beam_oth.4 cod.27.47d20 1 10.1360000
#> 3 min 2016 BE_Beam<24 beam_oth.4 cod.27.47d20 1 4.1670000
#> 4 min 2017 BE_Beam<24 beam_oth.4 cod.27.47d20 1 0.8370000
#> 5 min 2018 BE_Beam<24 beam_oth.4 cod.27.47d20 1 0.6790000
#> 6 min 2019 BE_Beam<24 beam_oth.4 cod.27.47d20 1 0.3000000
#> 7 min 2020 BE_Beam<24 beam_oth.4 cod.27.47d20 1 0.4490000
#> 8 min 2021 BE_Beam<24 beam_oth.4 cod.27.47d20 1 0.5114789
#> 9 min 2022 BE_Beam<24 beam_oth.4 cod.27.47d20 1 0.2920144
#> 10 min 2023 BE_Beam<24 beam_oth.4 cod.27.47d20 1 0.2674792
#> 11 min 2014 BE_Beam<24 beam_oth.4 ple.27.420 1 3.9050000
#> 12 min 2015 BE_Beam<24 beam_oth.4 ple.27.420 1 5.5970000
#> 13 min 2016 BE_Beam<24 beam_oth.4 ple.27.420 1 5.8080000
#> 14 min 2017 BE_Beam<24 beam_oth.4 ple.27.420 1 5.1610000
#> 15 min 2018 BE_Beam<24 beam_oth.4 ple.27.420 1 8.2040000
#> 16 min 2019 BE_Beam<24 beam_oth.4 ple.27.420 1 3.2740000
#> 17 min 2020 BE_Beam<24 beam_oth.4 ple.27.420 1 2.9970000
#> 18 min 2021 BE_Beam<24 beam_oth.4 ple.27.420 1 2.1127203
#> 19 min 2022 BE_Beam<24 beam_oth.4 ple.27.420 1 1.3534085
#> 20 min 2023 BE_Beam<24 beam_oth.4 ple.27.420 1 1.0889421
#> 21 min 2014 BE_Beam<24 beam_oth.4 sol.27.4 1 2.7980000
#> 22 min 2015 BE_Beam<24 beam_oth.4 sol.27.4 1 2.7030000
#> 23 min 2016 BE_Beam<24 beam_oth.4 sol.27.4 1 3.4500000
#> 24 min 2017 BE_Beam<24 beam_oth.4 sol.27.4 1 2.1290000
#> 25 min 2018 BE_Beam<24 beam_oth.4 sol.27.4 1 4.7550000
#> 26 min 2019 BE_Beam<24 beam_oth.4 sol.27.4 1 3.4500000
#> 27 min 2020 BE_Beam<24 beam_oth.4 sol.27.4 1 10.2840000
#> 28 min 2021 BE_Beam<24 beam_oth.4 sol.27.4 1 14.3299048
#> 29 min 2022 BE_Beam<24 beam_oth.4 sol.27.4 1 6.9361104
#> 30 min 2023 BE_Beam<24 beam_oth.4 sol.27.4 1 4.6793962
#> 31 min 2014 BE_Beam<24 beam_oth.4 tur.27.4 1 0.2150000
#> 32 min 2015 BE_Beam<24 beam_oth.4 tur.27.4 1 0.4780000
#> 33 min 2016 BE_Beam<24 beam_oth.4 tur.27.4 1 2.2490000
#> 34 min 2017 BE_Beam<24 beam_oth.4 tur.27.4 1 0.4550000
#> 35 min 2018 BE_Beam<24 beam_oth.4 tur.27.4 1 0.5720000
#> 36 min 2019 BE_Beam<24 beam_oth.4 tur.27.4 1 0.2180000
#> 37 min 2020 BE_Beam<24 beam_oth.4 tur.27.4 1 0.7370000
#> 38 min 2021 BE_Beam<24 beam_oth.4 tur.27.4 1 0.8187108
#> 39 min 2022 BE_Beam<24 beam_oth.4 tur.27.4 1 0.3948653
#> 40 min 2023 BE_Beam<24 beam_oth.4 tur.27.4 1 0.2837881
#> 41 min 2014 BE_Beam<24 beam_oth.4 whg.27.47d 1 0.4820000
#> 42 min 2015 BE_Beam<24 beam_oth.4 whg.27.47d 1 6.4980000
#> 43 min 2016 BE_Beam<24 beam_oth.4 whg.27.47d 1 12.5480000
#> 44 min 2017 BE_Beam<24 beam_oth.4 whg.27.47d 1 6.6860000
#> 45 min 2018 BE_Beam<24 beam_oth.4 whg.27.47d 1 6.8800000
#> 46 min 2019 BE_Beam<24 beam_oth.4 whg.27.47d 1 4.9530000
#> 47 min 2020 BE_Beam<24 beam_oth.4 whg.27.47d 1 7.4250000
#> 48 min 2021 BE_Beam<24 beam_oth.4 whg.27.47d 1 6.5972415
#> 49 min 2022 BE_Beam<24 beam_oth.4 whg.27.47d 1 4.5648035
#> 50 min 2023 BE_Beam<24 beam_oth.4 whg.27.47d 1 3.6064718
#> 51 min 2014 BE_Beam<24 BT2.4 cod.27.47d20 1 15.9470000
#> 52 min 2015 BE_Beam<24 BT2.4 cod.27.47d20 1 43.0210000
#> 53 min 2016 BE_Beam<24 BT2.4 cod.27.47d20 1 10.6390000
#> 54 min 2017 BE_Beam<24 BT2.4 cod.27.47d20 1 1.9400000
#> 55 min 2018 BE_Beam<24 BT2.4 cod.27.47d20 1 1.8220000
#> 56 min 2019 BE_Beam<24 BT2.4 cod.27.47d20 1 0.5890000
#> 57 min 2020 BE_Beam<24 BT2.4 cod.27.47d20 1 0.4580000
#> 58 min 2021 BE_Beam<24 BT2.4 cod.27.47d20 1 0.4322805
#> 59 min 2022 BE_Beam<24 BT2.4 cod.27.47d20 1 0.2069910
#> 60 min 2023 BE_Beam<24 BT2.4 cod.27.47d20 1 0.1432135
#> 61 min 2014 BE_Beam<24 BT2.4 ple.27.420 1 632.2080000
#> 62 min 2015 BE_Beam<24 BT2.4 ple.27.420 1 431.9260000
#> 63 min 2016 BE_Beam<24 BT2.4 ple.27.420 1 262.6750000
#> 64 min 2017 BE_Beam<24 BT2.4 ple.27.420 1 181.2240000
#> 65 min 2018 BE_Beam<24 BT2.4 ple.27.420 1 112.8280000
#> 66 min 2019 BE_Beam<24 BT2.4 ple.27.420 1 42.0950000
#> 67 min 2020 BE_Beam<24 BT2.4 ple.27.420 1 23.2720000
#> 68 min 2021 BE_Beam<24 BT2.4 ple.27.420 1 14.9428986
#> 69 min 2022 BE_Beam<24 BT2.4 ple.27.420 1 8.9538493
#> 70 min 2023 BE_Beam<24 BT2.4 ple.27.420 1 8.0126159
#> 71 min 2014 BE_Beam<24 BT2.4 sol.27.4 1 276.0520000
#> 72 min 2015 BE_Beam<24 BT2.4 sol.27.4 1 271.1700000
#> 73 min 2016 BE_Beam<24 BT2.4 sol.27.4 1 162.8160000
#> 74 min 2017 BE_Beam<24 BT2.4 sol.27.4 1 93.6100000
#> 75 min 2018 BE_Beam<24 BT2.4 sol.27.4 1 75.3710000
#> 76 min 2019 BE_Beam<24 BT2.4 sol.27.4 1 59.8560000
#> 77 min 2020 BE_Beam<24 BT2.4 sol.27.4 1 95.5400000
#> 78 min 2021 BE_Beam<24 BT2.4 sol.27.4 1 121.5086832
#> 79 min 2022 BE_Beam<24 BT2.4 sol.27.4 1 78.6904140
#> 80 min 2023 BE_Beam<24 BT2.4 sol.27.4 1 44.6125591
#> 81 min 2014 BE_Beam<24 BT2.4 tur.27.4 1 7.0480000
#> 82 min 2015 BE_Beam<24 BT2.4 tur.27.4 1 9.5080000
#> 83 min 2016 BE_Beam<24 BT2.4 tur.27.4 1 5.9970000
#> 84 min 2017 BE_Beam<24 BT2.4 tur.27.4 1 7.5150000
#> 85 min 2018 BE_Beam<24 BT2.4 tur.27.4 1 4.2780000
#> 86 min 2019 BE_Beam<24 BT2.4 tur.27.4 1 3.3980000
#> 87 min 2020 BE_Beam<24 BT2.4 tur.27.4 1 2.3330000
#> 88 min 2021 BE_Beam<24 BT2.4 tur.27.4 1 2.4742981
#> 89 min 2022 BE_Beam<24 BT2.4 tur.27.4 1 1.1375289
#> 90 min 2023 BE_Beam<24 BT2.4 tur.27.4 1 0.7358918
#> 91 min 2014 BE_Beam<24 BT2.4 whg.27.47d 1 3.7720000
#> 92 min 2015 BE_Beam<24 BT2.4 whg.27.47d 1 6.4930000
#> 93 min 2016 BE_Beam<24 BT2.4 whg.27.47d 1 2.6610000
#> 94 min 2017 BE_Beam<24 BT2.4 whg.27.47d 1 1.0430000
#> 95 min 2018 BE_Beam<24 BT2.4 whg.27.47d 1 1.8020000
#> 96 min 2019 BE_Beam<24 BT2.4 whg.27.47d 1 3.4510000
#> 97 min 2020 BE_Beam<24 BT2.4 whg.27.47d 1 1.5040000
#> 98 min 2021 BE_Beam<24 BT2.4 whg.27.47d 1 1.0662578
#> 99 min 2022 BE_Beam<24 BT2.4 whg.27.47d 1 0.7355171
#> 100 min 2023 BE_Beam<24 BT2.4 whg.27.47d 1 0.5745655
#> discards revst catch discRat price area country
#> 1 1.50641080 10990.6000 5.8854108 0.255956780 2509.8424 4 BE
#> 2 4.63365658 28130.8400 14.7696566 0.313728119 2775.3394 4 BE
#> 3 1.86299472 13228.1300 6.0299947 0.308954619 3174.4972 4 BE
#> 4 0.22570067 1897.7500 1.0627007 0.212384050 2267.3238 4 BE
#> 5 0.13320816 1793.0600 0.8122082 0.164007413 2640.7364 4 BE
#> 6 0.03523511 682.8800 0.3352351 0.105105679 2276.2667 4 BE
#> 7 0.08698706 1140.0600 0.5359871 0.162293206 2539.1091 4 BE
#> 8 0.16054440 1298.7008 0.6720233 0.238897061 2539.1091 4 BE
#> 9 0.05408551 741.4564 0.3460999 0.156271388 2539.1091 4 BE
#> 10 0.03792705 679.1590 0.3054063 0.124185566 2539.1091 4 BE
#> 11 8.08254024 3631.2500 11.9875402 0.674245098 929.8976 4 BE
#> 12 0.00000000 5609.9000 5.5970000 0.000000000 1002.3048 4 BE
#> 13 7.12178876 6367.1800 12.9297888 0.550804726 1096.2775 4 BE
#> 14 4.15002644 6941.7600 9.3110264 0.445710950 1345.0417 4 BE
#> 15 0.00000000 16425.2800 8.2040000 0.000000000 2002.1063 4 BE
#> 16 4.94530163 6306.4200 8.2193016 0.601669321 1926.2126 4 BE
#> 17 7.88053281 4224.7400 10.8775328 0.724477963 1409.6563 4 BE
#> 18 9.68491569 2978.2095 11.7976360 0.820920031 1409.6563 4 BE
#> 19 4.51743392 1907.8409 5.8708424 0.769469452 1409.6563 4 BE
#> 20 2.89265833 1535.0341 3.9816004 0.726506437 1409.6563 4 BE
#> 21 0.01613988 25349.2100 2.8141399 0.005735281 9059.7605 4 BE
#> 22 2.71665516 25348.6500 5.4196552 0.501259782 9377.9689 4 BE
#> 23 2.73162867 34219.4000 6.1816287 0.441894655 9918.6667 4 BE
#> 24 0.00000000 21576.8900 2.1290000 0.000000000 10134.7534 4 BE
#> 25 0.00000000 51901.4100 4.7550000 0.000000000 10915.1230 4 BE
#> 26 0.54869064 39015.0400 3.9986906 0.137217577 11308.7072 4 BE
#> 27 36.72182115 96445.5100 47.0058212 0.781218586 9378.2098 4 BE
#> 28 4.94824480 134388.8546 19.2781496 0.256676335 9378.2098 4 BE
#> 29 5.24412094 65048.2985 12.1802313 0.430543625 9378.2098 4 BE
#> 30 3.48388213 43884.3592 8.1632783 0.426774882 9378.2098 4 BE
#> 31 0.00000000 1844.5200 0.2150000 0.000000000 8579.1628 4 BE
#> 32 0.00000000 3070.7000 0.4780000 0.000000000 6424.0586 4 BE
#> 33 0.00000000 13609.7000 2.2490000 0.000000000 6051.4451 4 BE
#> 34 0.00000000 3883.7700 0.4550000 0.000000000 8535.7582 4 BE
#> 35 0.00000000 6437.1400 0.5720000 0.000000000 11253.7413 4 BE
#> 36 0.00000000 1707.7200 0.2180000 0.000000000 7833.5780 4 BE
#> 37 0.00000000 5241.4900 0.7370000 0.000000000 7111.9267 4 BE
#> 38 0.02415998 5822.6115 0.8428708 0.028663914 7111.9267 4 BE
#> 39 0.00000000 2808.2527 0.3948653 0.000000000 7111.9267 4 BE
#> 40 0.00000000 2018.2804 0.2837881 0.000000000 7111.9267 4 BE
#> 41 0.19217431 493.4150 0.6741743 0.285051369 1023.6826 4 BE
#> 42 9.26621259 4497.7200 15.7642126 0.587800535 692.1699 4 BE
#> 43 10.39239686 9987.0500 22.9403969 0.453017309 795.9077 4 BE
#> 44 4.49119635 4538.2900 11.1771964 0.401817791 678.7751 4 BE
#> 45 2.70828639 3245.2600 9.5882864 0.282457811 471.6948 4 BE
#> 46 2.08575623 3043.4300 7.0387562 0.296324544 614.4619 4 BE
#> 47 4.16543516 4101.4500 11.5904352 0.359385571 552.3838 4 BE
#> 48 7.45908633 3644.2096 14.0563278 0.530656827 552.3838 4 BE
#> 49 3.57395468 2521.5237 8.1387582 0.439127763 552.3838 4 BE
#> 50 2.19664293 1992.1568 5.8031148 0.378528258 552.3838 4 BE
#> 51 7.11591870 39237.9500 23.0629187 0.308543719 2460.5224 4 BE
#> 52 0.83904565 102290.3200 43.8600457 0.019130068 2377.6835 4 BE
#> 53 0.10808599 32532.7600 10.7470860 0.010057237 3057.8776 4 BE
#> 54 0.33900719 5764.3800 2.2790072 0.148752136 2971.3299 4 BE
#> 55 0.09997031 5279.6500 1.9219703 0.052014492 2897.7223 4 BE
#> 56 0.01900866 1572.4900 0.6080087 0.031263805 2669.7623 4 BE
#> 57 0.14614387 1325.8900 0.6041439 0.241902428 2894.9563 4 BE
#> 58 0.16448180 1251.4331 0.5967623 0.275623650 2894.9563 4 BE
#> 59 0.07989506 599.2299 0.2868861 0.278490571 2894.9563 4 BE
#> 60 0.04964635 414.5969 0.1928599 0.257421874 2894.9563 4 BE
#> 61 288.91652220 728501.7300 921.1245222 0.313656314 1152.3134 4 BE
#> 62 936.98610096 569962.4100 1368.9121010 0.684474993 1319.5835 4 BE
#> 63 310.08100764 354772.8600 572.7560076 0.541384121 1350.6152 4 BE
#> 64 160.21496528 289489.0200 341.4389653 0.469234568 1597.4099 4 BE
#> 65 76.08566787 255584.3200 188.9136679 0.402753643 2265.2561 4 BE
#> 66 65.76043844 92111.4200 107.8554384 0.609709064 2188.1796 4 BE
#> 67 69.37392480 40935.3400 92.6459248 0.748807084 1758.9954 4 BE
#> 68 113.51468109 26284.4892 128.4575796 0.883674450 1758.9954 4 BE
#> 69 49.59561827 15749.7793 58.5494676 0.847072063 1758.9954 4 BE
#> 70 36.27443708 14094.1543 44.2870530 0.819075432 1758.9954 4 BE
#> 71 59.59742057 2274553.7600 335.6494206 0.177558539 8239.5844 4 BE
#> 72 72.25802443 2467232.3000 343.4280244 0.210402237 9098.4707 4 BE
#> 73 31.16533393 1560007.2500 193.9813339 0.160661510 9581.4125 4 BE
#> 74 20.13151662 930550.0100 113.7415166 0.176993566 9940.7116 4 BE
#> 75 11.76856270 795123.8400 87.1395627 0.135054186 10549.4665 4 BE
#> 76 14.18307294 636964.4700 74.0390729 0.191562001 10641.6144 4 BE
#> 77 25.84500677 927574.6500 121.3850068 0.212917620 9708.7571 4 BE
#> 78 69.27786799 1179698.2861 190.7865512 0.363117146 9708.7571 4 BE
#> 79 25.81861778 763986.1132 104.5090318 0.247046761 9708.7571 4 BE
#> 80 20.20726244 433132.4982 64.8198215 0.311745111 9708.7571 4 BE
#> 81 0.00000000 70571.9000 7.0480000 0.000000000 10013.0392 4 BE
#> 82 0.00000000 86568.6900 9.5080000 0.000000000 9104.8265 4 BE
#> 83 0.00000000 54448.1600 5.9970000 0.000000000 9079.2329 4 BE
#> 84 0.00000000 66570.5600 7.5150000 0.000000000 8858.3580 4 BE
#> 85 0.00000000 43441.8800 4.2780000 0.000000000 10154.7172 4 BE
#> 86 0.00000000 34853.7600 3.3980000 0.000000000 10257.1395 4 BE
#> 87 0.00000000 21061.8500 2.3330000 0.000000000 9027.7968 4 BE
#> 88 0.07301599 22337.4601 2.5473140 0.028663914 9027.7968 4 BE
#> 89 0.00000000 10269.3800 1.1375289 0.000000000 9027.7968 4 BE
#> 90 0.00000000 6643.4815 0.7358918 0.000000000 9027.7968 4 BE
#> 91 11.51593293 4597.6050 15.2879329 0.753269457 1218.8773 4 BE
#> 92 33.51386905 5674.0900 40.0068691 0.837702871 873.8780 4 BE
#> 93 6.73864601 2052.3100 9.3996460 0.716904233 771.2552 4 BE
#> 94 3.26864564 652.7000 4.3116456 0.758097003 625.7910 4 BE
#> 95 5.22513312 1169.6600 7.0271331 0.743565410 649.0899 4 BE
#> 96 31.01715772 2091.5000 34.4681577 0.899878606 606.0562 4 BE
#> 97 11.37678218 1094.6300 12.8807822 0.883236904 727.8125 4 BE
#> 98 14.66057123 776.0357 15.7268290 0.932201349 727.8125 4 BE
#> 99 7.92858667 535.3185 8.6641038 0.915107540 727.8125 4 BE
#> 100 4.85270033 418.1759 5.4272658 0.894133529 727.8125 4 BE
selectors <- c("year")
divider <- c("fleet")
p <- plot_catchComp(data, refTable, filters = NULL, selectors, divider, yvar = "catch")
# ggplot format adjustments
p <- p + theme(text = element_text(size = 8),
axis.text.x = element_text(angle = 90, vjust = 0, hjust=1)) +
facet_wrap(divider, scales = "fixed") # remove free axes
fname <- paste0(tempfile(), ".png")
png(fname, width = 6, height = 6, units = "in", res = 400)
suppressWarnings(print(p))
out <- dev.off()
tmp <- png::readPNG(fname)
knitr::include_graphics(fname, dpi = floor(dim(tmp)[2]/6))
selectors <- c("country", "metier")
divider <- c("area")
p <- plot_catchComp(data,refTable,filters = NULL,selectors, divider)
p <- p + theme(text = element_text(size = 8),
axis.text.x = element_text(angle = 90, vjust = 0, hjust=1))
fname <- paste0(tempfile(), ".png")
png(fname, width = 7, height = 6, units = "in", res = 400)
suppressWarnings(print(p))
out <- dev.off()
tmp <- png::readPNG(fname)
knitr::include_graphics(fname, dpi = floor(dim(tmp)[2]/6))
filters <- list(year = 2020) # e.g. last historical data year
selectors <- c("metier")
divider <- c("country")
p <- plot_catchComp(data, refTable, filters, selectors, divider)
p <- p + theme(text = element_text(size = 8),
axis.text.x = element_text(angle = 90, vjust = 0, hjust=1))
fname <- paste0(tempfile(), ".png")
png(fname, width = 7, height = 6, units = "in", res = 400)
suppressWarnings(print(p))
out <- dev.off()
tmp <- png::readPNG(fname)
knitr::include_graphics(fname, dpi = floor(dim(tmp)[2]/6))
Two main objects used by the plot_overUnderFltStk
function: a data
object and the refTable
object.
The data
object contains the catch
per
stock and fleet, and associated quota uptake (quotaUpt
),
which is the ratio of the catch to the fleet’s quota share (i.e. a value
of 1.0
means full uptake). Finally, The variable
Limitation
provides information on most- and least-limiting
stocks for each fleet (lowest and highest quotaEffort
,
respectively), while other stocks are designated with
NA
.
data[1:100,]
#> fleet stock catch quotaUpt Limitation
#> BE_Beam<24.1 BE_Beam<24 cod.27.47d20 1.179056e+00 1.0000000 most
#> BE_Beam<24.2 BE_Beam<24 ple.27.420 6.442031e+01 0.3621390 <NA>
#> BE_Beam<24.3 BE_Beam<24 sol.27.4 1.166893e+02 0.5113243 <NA>
#> BE_Beam<24.4 BE_Beam<24 tur.27.4 1.828944e+01 0.4539531 <NA>
#> BE_Beam<24.5 BE_Beam<24 whg.27.47d 5.936659e+01 0.2685435 least
#> BE_Beam<24.6 BE_Beam<24 had.27.46a20 4.298913e-01 0.4147608 <NA>
#> BE_Beam<24.7 BE_Beam<24 wit.27.3a47d 7.889361e-04 0.9744229 <NA>
#> BE_Beam<24.8 BE_Beam<24 ple.27.7d 2.875940e+02 0.3373438 <NA>
#> BE_Beam<24.9 BE_Beam<24 sol.27.7d 1.314579e+02 0.6185523 <NA>
#> BE_Beam>=24.10 BE_Beam>=24 cod.27.47d20 4.953274e+02 1.0000000 most
#> BE_Beam>=24.11 BE_Beam>=24 ple.27.420 1.632274e+03 0.3785269 <NA>
#> BE_Beam>=24.12 BE_Beam>=24 sol.27.4 1.103295e+02 0.5710010 <NA>
#> BE_Beam>=24.13 BE_Beam>=24 tur.27.4 4.653209e+01 0.4541272 <NA>
#> BE_Beam>=24.14 BE_Beam>=24 whg.27.47d 1.092357e+02 0.2578275 least
#> BE_Beam>=24.15 BE_Beam>=24 had.27.46a20 3.609378e+02 0.3987683 <NA>
#> BE_Beam>=24.16 BE_Beam>=24 wit.27.3a47d 7.436899e-01 0.8962339 <NA>
#> BE_Beam>=24.17 BE_Beam>=24 ple.27.7d 3.878179e+02 0.3244299 <NA>
#> BE_Beam>=24.18 BE_Beam>=24 sol.27.7d 2.837640e+02 0.5948735 <NA>
#> BE_Beam>=24.19 BE_Beam>=24 nep.27.4outFU 4.312228e-02 0.9544001 <NA>
#> BE_Beam>=24.20 BE_Beam>=24 pok.27.3a46 1.750230e+00 0.5888816 <NA>
#> BE_Beam>=24.21 BE_Beam>=24 nep.fu.5 9.500239e-01 0.2180324 <NA>
#> BE_DSeine.22 BE_DSeine cod.27.47d20 5.724904e+00 1.0000000 most
#> BE_DSeine.23 BE_DSeine ple.27.420 2.737325e+00 0.3706137 <NA>
#> BE_DSeine.24 BE_DSeine sol.27.4 1.458028e-02 0.3351956 <NA>
#> BE_DSeine.25 BE_DSeine tur.27.4 2.317999e-01 0.4086448 <NA>
#> BE_DSeine.26 BE_DSeine whg.27.47d 3.003627e+02 0.2482784 least
#> BE_DSeine.27 BE_DSeine had.27.46a20 8.687189e+00 0.4546176 <NA>
#> BE_DSeine.28 BE_DSeine ple.27.7d 3.294580e+00 0.2916319 <NA>
#> BE_DSeine.29 BE_DSeine sol.27.7d 1.093434e+00 0.5209182 <NA>
#> BE_DSeine.30 BE_DSeine nep.27.4outFU 4.331100e-04 0.9298196 <NA>
#> BE_DSeine.31 BE_DSeine nep.fu.5 8.662201e-04 0.2124170 <NA>
#> BE_Otter.32 BE_Otter cod.27.47d20 8.277466e+00 1.0000000 most
#> BE_Otter.33 BE_Otter ple.27.420 1.207490e+03 0.3344489 <NA>
#> BE_Otter.34 BE_Otter sol.27.4 2.155300e+01 0.2182179 least
#> BE_Otter.35 BE_Otter tur.27.4 5.251125e+01 0.5090884 <NA>
#> BE_Otter.36 BE_Otter whg.27.47d 9.037471e+01 0.2526881 <NA>
#> BE_Otter.37 BE_Otter had.27.46a20 1.953295e+00 0.4591323 <NA>
#> BE_Otter.38 BE_Otter wit.27.3a47d 7.626900e+00 0.7967830 <NA>
#> BE_Otter.39 BE_Otter ple.27.7d 7.332101e-01 0.2927764 <NA>
#> BE_Otter.40 BE_Otter sol.27.7d 4.802993e-01 0.5236355 <NA>
#> BE_Otter.41 BE_Otter nep.27.4outFU 3.602729e+01 0.9343548 <NA>
#> BE_Otter.42 BE_Otter nep.fu.5 8.231233e+01 0.2134531 <NA>
#> BE_Otter.43 BE_Otter nep.fu.33 1.729365e+02 0.7338690 <NA>
#> DK_Otter<24.44 DK_Otter<24 cod.27.47d20 3.695135e+02 1.0000000 most
#> DK_Otter<24.45 DK_Otter<24 ple.27.420 7.919593e+02 0.3359157 <NA>
#> DK_Otter<24.46 DK_Otter<24 sol.27.4 2.189794e+00 0.6781308 <NA>
#> DK_Otter<24.47 DK_Otter<24 tur.27.4 1.657692e+01 0.4379661 <NA>
#> DK_Otter<24.48 DK_Otter<24 whg.27.47d 1.115906e+00 0.2564421 least
#> DK_Otter<24.49 DK_Otter<24 had.27.46a20 9.682296e+01 0.3142720 <NA>
#> DK_Otter<24.50 DK_Otter<24 wit.27.3a47d 1.361272e+02 0.8122189 <NA>
#> DK_Otter<24.51 DK_Otter<24 nep.27.4outFU 1.084372e-01 0.8465374 <NA>
#> DK_Otter<24.52 DK_Otter<24 pok.27.3a46 7.706498e+01 0.5335035 <NA>
#> DK_Otter<24.53 DK_Otter<24 nep.fu.33 4.580388e+00 0.6648946 <NA>
#> DK_Otter<24.54 DK_Otter<24 nep.fu.32 7.768048e-02 0.1862916 <NA>
#> DK_Otter>=24.55 DK_Otter>=24 cod.27.47d20 7.103478e+02 1.0000000 most
#> DK_Otter>=24.56 DK_Otter>=24 ple.27.420 1.045207e+03 0.3032613 <NA>
#> DK_Otter>=24.57 DK_Otter>=24 sol.27.4 5.680819e-01 0.3873688 <NA>
#> DK_Otter>=24.58 DK_Otter>=24 tur.27.4 3.108967e+01 0.4147212 <NA>
#> DK_Otter>=24.59 DK_Otter>=24 whg.27.47d 3.355962e+01 0.2335475 <NA>
#> DK_Otter>=24.60 DK_Otter>=24 had.27.46a20 6.461334e+02 0.5466124 <NA>
#> DK_Otter>=24.61 DK_Otter>=24 wit.27.3a47d 8.839463e+01 0.6324454 <NA>
#> DK_Otter>=24.62 DK_Otter>=24 nep.27.4outFU 4.565643e+00 0.7730066 <NA>
#> DK_Otter>=24.63 DK_Otter>=24 pok.27.3a46 5.836622e+02 0.5763869 <NA>
#> DK_Otter>=24.64 DK_Otter>=24 nep.fu.5 1.512279e-02 0.1765931 <NA>
#> DK_Otter>=24.65 DK_Otter>=24 nep.fu.33 9.647262e+00 0.6071415 <NA>
#> DK_Otter>=24.66 DK_Otter>=24 nep.fu.32 9.413939e+00 0.1701102 <NA>
#> DK_Otter>=24.67 DK_Otter>=24 nep.fu.7 1.394130e-01 0.1355084 least
#> DK_Seine.68 DK_Seine cod.27.47d20 4.799721e+02 1.0000000 most
#> DK_Seine.69 DK_Seine ple.27.420 6.272085e+02 0.2924910 <NA>
#> DK_Seine.70 DK_Seine tur.27.4 8.809011e-01 0.3613513 <NA>
#> DK_Seine.71 DK_Seine whg.27.47d 8.770709e+00 0.2140430 least
#> DK_Seine.72 DK_Seine had.27.46a20 4.592894e+02 0.5103962 <NA>
#> DK_Seine.73 DK_Seine wit.27.3a47d 2.304141e+01 0.7103455 <NA>
#> DK_Seine.74 DK_Seine pok.27.3a46 1.065240e+02 0.5177137 <NA>
#> DK_Seine.75 DK_Seine nep.fu.32 1.049308e-03 0.1652454 <NA>
#> DK_Static.76 DK_Static cod.27.47d20 3.345203e+02 1.0000000 most
#> DK_Static.77 DK_Static ple.27.420 1.589533e+03 0.2787537 <NA>
#> DK_Static.78 DK_Static sol.27.4 8.283899e+01 0.4267172 <NA>
#> DK_Static.79 DK_Static tur.27.4 4.110168e+01 0.4104126 <NA>
#> DK_Static.80 DK_Static whg.27.47d 1.054132e-01 0.2153263 least
#> DK_Static.81 DK_Static had.27.46a20 1.443172e+01 0.3642314 <NA>
#> DK_Static.82 DK_Static wit.27.3a47d 7.270930e-01 0.5696111 <NA>
#> DK_Static.83 DK_Static pok.27.3a46 3.693454e+00 0.5489354 <NA>
#> EN_<10.84 EN_<10 cod.27.47d20 3.292122e+01 1.0000000 most
#> EN_<10.85 EN_<10 ple.27.420 1.806009e+01 0.3389775 <NA>
#> EN_<10.86 EN_<10 sol.27.4 7.202350e+01 0.5359974 <NA>
#> EN_<10.87 EN_<10 tur.27.4 9.148208e+00 0.4415401 <NA>
#> EN_<10.88 EN_<10 whg.27.47d 1.124004e+02 0.2553798 least
#> EN_<10.89 EN_<10 had.27.46a20 7.405011e+00 0.2850049 <NA>
#> EN_<10.90 EN_<10 wit.27.3a47d 1.033674e-01 0.8894142 <NA>
#> EN_<10.91 EN_<10 ple.27.7d 1.435929e+02 0.3286476 <NA>
#> EN_<10.92 EN_<10 sol.27.7d 8.776409e+01 0.5853669 <NA>
#> EN_<10.93 EN_<10 nep.27.4outFU 3.506647e-01 0.9541475 <NA>
#> EN_<10.94 EN_<10 pok.27.3a46 9.714586e-02 0.5758619 <NA>
#> EN_<10.95 EN_<10 nep.fu.6 2.160037e+02 0.5094570 <NA>
#> EN_Beam.96 EN_Beam cod.27.47d20 3.769180e+00 0.5892616 <NA>
#> EN_Beam.97 EN_Beam ple.27.420 9.192679e+02 0.1789439 <NA>
#> EN_Beam.98 EN_Beam sol.27.4 1.477561e+02 0.2385308 <NA>
#> EN_Beam.99 EN_Beam tur.27.4 3.989833e+01 0.2340528 <NA>
#> EN_Beam.100 EN_Beam whg.27.47d 2.914816e+01 0.1743459 least
Two main objects used by the plot_catchAlluvial
function: a data
object and the refTable
object.
The data
object contains the catches or landings
(variable value
) per fleet
,
metier
and stock
. The typical
refTable
object is also used to, which contains the
corresponding colors (col
), plotting order
(order
) for each stock
.
data[1:100,]
#> fleet metier stock value
#> 7 BE_Beam<24 beam_oth.4 cod.27.47d20 0.44900
#> 17 BE_Beam<24 beam_oth.4 ple.27.420 2.99700
#> 27 BE_Beam<24 beam_oth.4 sol.27.4 10.28400
#> 37 BE_Beam<24 beam_oth.4 tur.27.4 0.73700
#> 47 BE_Beam<24 beam_oth.4 whg.27.47d 7.42500
#> 57 BE_Beam<24 BT2.4 cod.27.47d20 0.45800
#> 67 BE_Beam<24 BT2.4 ple.27.420 23.27200
#> 77 BE_Beam<24 BT2.4 sol.27.4 95.54000
#> 87 BE_Beam<24 BT2.4 tur.27.4 2.33300
#> 97 BE_Beam<24 BT2.4 whg.27.47d 1.50400
#> 107 BE_Beam<24 BT2.4 had.27.46a20 0.00100
#> 117 BE_Beam<24 BT2.4 wit.27.3a47d 0.00100
#> 127 BE_Beam<24 BT2.7D cod.27.47d20 0.65300
#> 137 BE_Beam<24 BT2.7D tur.27.4 36.70500
#> 147 BE_Beam<24 BT2.7D whg.27.47d 7.40700
#> 157 BE_Beam<24 BT2.7D had.27.46a20 0.03600
#> 167 BE_Beam<24 BT2.7D ple.27.7d 246.10565
#> 177 BE_Beam<24 BT2.7D sol.27.7d 210.49400
#> 187 BE_Beam>=24 BT1.4 cod.27.47d20 642.95600
#> 197 BE_Beam>=24 BT1.4 ple.27.420 1513.15700
#> 207 BE_Beam>=24 BT1.4 sol.27.4 27.99100
#> 217 BE_Beam>=24 BT1.4 tur.27.4 32.98000
#> 227 BE_Beam>=24 BT1.4 whg.27.47d 10.04800
#> 237 BE_Beam>=24 BT1.4 had.27.46a20 31.24800
#> 247 BE_Beam>=24 BT1.4 wit.27.3a47d 0.90100
#> 257 BE_Beam>=24 BT1.4 nep.27.4outFU 0.00100
#> 267 BE_Beam>=24 BT1.4 pok.27.3a46 4.51000
#> 277 BE_Beam>=24 BT2.4 cod.27.47d20 23.93900
#> 287 BE_Beam>=24 BT2.4 ple.27.420 130.59200
#> 297 BE_Beam>=24 BT2.4 sol.27.4 90.12000
#> 307 BE_Beam>=24 BT2.4 tur.27.4 23.10200
#> 317 BE_Beam>=24 BT2.4 whg.27.47d 2.53100
#> 327 BE_Beam>=24 BT2.4 had.27.46a20 0.89200
#> 337 BE_Beam>=24 BT2.4 wit.27.3a47d 0.07500
#> 347 BE_Beam>=24 BT2.4 nep.27.4outFU 0.09600
#> 357 BE_Beam>=24 BT2.4 pok.27.3a46 0.07400
#> 367 BE_Beam>=24 BT2.4 nep.fu.5 2.13700
#> 377 BE_Beam>=24 BT2.7D cod.27.47d20 7.40300
#> 387 BE_Beam>=24 BT2.7D tur.27.4 45.07500
#> 397 BE_Beam>=24 BT2.7D whg.27.47d 15.31200
#> 407 BE_Beam>=24 BT2.7D had.27.46a20 0.81800
#> 417 BE_Beam>=24 BT2.7D wit.27.3a47d 0.27900
#> 427 BE_Beam>=24 BT2.7D ple.27.7d 345.08135
#> 437 BE_Beam>=24 BT2.7D sol.27.7d 472.45700
#> 447 BE_Beam>=24 BT2.7D pok.27.3a46 0.01600
#> 457 BE_DSeine OTH cod.27.47d20 7.98700
#> 467 BE_DSeine OTH ple.27.420 3.30700
#> 477 BE_DSeine OTH sol.27.4 0.03000
#> 487 BE_DSeine OTH tur.27.4 0.18600
#> 497 BE_DSeine OTH whg.27.47d 144.86400
#> 507 BE_DSeine OTH had.27.46a20 4.65000
#> 517 BE_DSeine OTH ple.27.7d 0.48070
#> 527 BE_DSeine OTH sol.27.7d 0.00900
#> 537 BE_DSeine OTH nep.27.4outFU 0.00100
#> 547 BE_DSeine OTH nep.fu.5 0.00200
#> 557 BE_DSeine TR2.7D cod.27.47d20 0.20900
#> 567 BE_DSeine TR2.7D tur.27.4 0.37400
#> 577 BE_DSeine TR2.7D whg.27.47d 10.11900
#> 587 BE_DSeine TR2.7D had.27.46a20 0.00300
#> 597 BE_DSeine TR2.7D ple.27.7d 2.98090
#> 607 BE_DSeine TR2.7D sol.27.7d 2.09900
#> 617 BE_Otter OTH cod.27.47d20 0.32100
#> 627 BE_Otter OTH ple.27.420 2.36800
#> 637 BE_Otter OTH sol.27.4 0.04200
#> 647 BE_Otter OTH tur.27.4 0.20900
#> 657 BE_Otter OTH whg.27.47d 37.98800
#> 667 BE_Otter OTH had.27.46a20 0.03200
#> 677 BE_Otter OTH wit.27.3a47d 0.01300
#> 687 BE_Otter OTH ple.27.7d 1.09205
#> 697 BE_Otter OTH sol.27.7d 0.92200
#> 707 BE_Otter OTH nep.fu.33 0.49600
#> 717 BE_Otter TR1.4 cod.27.47d20 2.54800
#> 727 BE_Otter TR1.4 ple.27.420 556.29400
#> 737 BE_Otter TR1.4 sol.27.4 0.52000
#> 747 BE_Otter TR1.4 tur.27.4 41.85100
#> 757 BE_Otter TR1.4 whg.27.47d 0.73200
#> 767 BE_Otter TR1.4 had.27.46a20 0.83100
#> 777 BE_Otter TR1.4 wit.27.3a47d 11.30200
#> 787 BE_Otter TR1.4 nep.27.4outFU 5.11200
#> 797 BE_Otter TR1.4 nep.fu.5 1.60400
#> 807 BE_Otter TR1.4 nep.fu.33 12.83000
#> 817 BE_Otter TR2.4 cod.27.47d20 8.93700
#> 827 BE_Otter TR2.4 ple.27.420 365.63600
#> 837 BE_Otter TR2.4 sol.27.4 16.06100
#> 847 BE_Otter TR2.4 tur.27.4 59.77100
#> 857 BE_Otter TR2.4 whg.27.47d 18.13800
#> 867 BE_Otter TR2.4 had.27.46a20 0.17600
#> 877 BE_Otter TR2.4 wit.27.3a47d 4.03000
#> 887 BE_Otter TR2.4 nep.27.4outFU 77.66700
#> 897 BE_Otter TR2.4 nep.fu.5 187.52300
#> 907 BE_Otter TR2.4 nep.fu.33 384.02600
#> NA <NA> <NA> <NA> NA
#> NA.1 <NA> <NA> <NA> NA
#> NA.2 <NA> <NA> <NA> NA
#> NA.3 <NA> <NA> <NA> NA
#> NA.4 <NA> <NA> <NA> NA
#> NA.5 <NA> <NA> <NA> NA
#> NA.6 <NA> <NA> <NA> NA
#> NA.7 <NA> <NA> <NA> NA
#> NA.8 <NA> <NA> <NA> NA
p <- plot_catchAlluvial(data = data, refTable = refTable, text_size = 2)
fname <- paste0(tempfile(), ".png")
png(fname, width = 6, height = 6, units = "in", res = 400)
suppressWarnings(print(p))
out <- dev.off()
tmp <- png::readPNG(fname)
knitr::include_graphics(fname, dpi = floor(dim(tmp)[2]/6))
As in the above example, labels may overlap with many levels or small
contributions. The plotting function has the option to try and arrange
the labels to prevent overlapping using the ggrepel
package
(argument: text_repel = TRUE
):
p <- plot_catchAlluvial(data = data, refTable = refTable, text_size = 2,
text_repel = TRUE, stratum_width = 0.2, nudge_x = 0.3, mult_x = c(0.1, 0.3))
fname <- paste0(tempfile(), ".png")
png(fname, width = 6, height = 6, units = "in", res = 400)
suppressWarnings(print(p))
out <- dev.off()
tmp <- png::readPNG(fname)
knitr::include_graphics(fname, dpi = floor(dim(tmp)[2]/6))
By default, the plot contains a legend as to the fill colors of the
stocks. This may be removed if the final stock stratum colors are
labelled clearly enough (argument: addLegend = FALSE
). The
following example also defines a different fill color for the non-stock
strata:
p <- plot_catchAlluvial(data = data, refTable = refTable, text_size = 2,
text_repel = TRUE, stratum_width = 0.2, nudge_x = 0.3, mult_x = c(0.1, 0.3),
addLegend = FALSE, stratum_col = "grey90")
fname <- paste0(tempfile(), ".png")
png(fname, width = 6, height = 6, units = "in", res = 400)
suppressWarnings(print(p))
out <- dev.off()
tmp <- png::readPNG(fname)
knitr::include_graphics(fname, dpi = floor(dim(tmp)[2]/6))