kobePlot: Function to do Kobe Plots

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/FUNCTION_kobePlot.r

Description

Plot 4 areas of risk in relation to a given overall threshold

Usage

1
2
3
4
5
kobePlot(dta, xNam = 'mean_effort', yNam = 'mean_overlap', gp = 'Spp',
                     xSdUp = 0, xSdLow = 0, ySdUp = 0, ySdLow = 0,
                     v, colPlt = colScale, gline = FALSE,
                     cutPlt = xxmax, xBks = seq(0,cutPlt, length.out = 10),
                     cutY = 100, yBks = seq(0,cutY, length.out = 5),...)

Arguments

dta

data.frame containing factor to be plotted, mean x and y risk values and standard deviation or standard error (optional)

xNam

name of column containing information of x axis to be plotted. Defaults to 'mean_effort'

yNam

name of column containing information of y axis to be plotted. Defaults to 'mean_effort'

gp

grouping factor. Defaults to 'Spp'

xSdUp

name of column containing information of SD or SE upper value of x axis to be plotted as an errorbar. Defaults to 0

xSdLow

name of column containing information of SD or SE lower value of x axis to be plotted as an errorbar. Defaults to 0

ySdUp

name of column containing information of SD or SE upper value of y axis to be plotted as an errorbar. Defaults to 0

ySdLow

name of column containing information of SD or SE lower value of y axis to be plotted as an errorbar. Defaults to 0

v

vector(x,y) of risk threshold. x: x axis threshold; y: yaxis threshold

colPlt

Colour vector to colour geom_points. Defaults to Species colour as in paper (See References). NULL returns automatically coloured points

gline

Logical. Connect points by a line? TRUE draws a geom_path connecting the plotted points. Default to FALSE.

Value

Kobe plot with 4 risk areas: green: Low effort and overlap risk; yellow: either overlap or effort with high risk, but low for the other variable. red: high effort and overlap risk

Author(s)

Marisa Vedor, Ivo da Costa, Nuno Queiroz

References

Adapted from https://gist.github.com/jcquiroz/2695825

See Also

overallFun sppFun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Read Species data

dta <- data.frame('Spp' = factor(c('PGL', 'IOX', 'CCA', 'GCU')),
'mean_effort' = c(1e-5, 0.5e-5, 0.8e-5, 0.1e-5),
'mean_overlap' = c(70,65,50,10),
"upSD_effort" = c(1e-5, 0.5e-5, 0.8e-5, 0.1e-5) + 0.1e-5
"lowSD_effort" = c(1e-5, 0.5e-5, 0.8e-5, 0.1e-5) - 0.1e-5
"upSD_overlap" = c(70,65,50,10) + 10
"lowSD_effort" = c(70,65,50,10) - 10
)


# Read overall risk
v <- c(mean(dta$mean_effort), mean(dta$mean_overlap))

#### Save kobe plot ####
print(kobePlot(dta = dta, xNam = 'mean_effort', yNam = 'mean_overlap', gp = 'Spp',
               xSdUp = "upSD_effort", xSdLow = "lowSD_effort",
               ySdUp = "upSD_overlap", ySdLow = "lowSD_effort",
               v = v))

ggsave(paste0('Fig3_', rg,'.pdf'), paper = 'a4r',
       width = 250, height = 150, units = 'mm')

GlobalSharkMovement/GSMP_rpackage documentation built on Feb. 13, 2021, 8:01 a.m.