-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpf_plot_2d.Rd
68 lines (59 loc) · 3.16 KB
/
pf_plot_2d.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pf_analyse_path.R
\name{pf_plot_2d}
\alias{pf_plot_2d}
\title{Map two-dimensional paths from a PF algorithm}
\usage{
pf_plot_2d(
paths,
bathy,
add_bathy = list(),
add_paths = list(),
prompt = FALSE,
...
)
}
\arguments{
\item{paths}{A dataframe containing reconstructed movement path(s) from \code{\link[flapper]{pf}} via \code{\link[flapper]{pf_simplify}} (see \code{\link[flapper]{pf_path-class}}). At a minimum, this should contain a unique identifier for each path (named `path_id') and the x and y coordinates that define the trajectory of each path (`cell_x' and `cell_y').}
\item{bathy}{A \code{\link[raster]{raster}} of the surface over which movement was reconstructed.}
\item{add_bathy}{A named list, passed to \code{\link[prettyGraphics]{pretty_map}}, to customise the appearance of the bathymetry surface.}
\item{add_paths}{A named list, passed to \code{\link[prettyGraphics]{add_sp_path}}, to customise the appearance of the paths.}
\item{prompt}{A logical input that defines whether or not plot each path on a separate plot, sequentially, with a pause between plots (\code{prompt = TRUE}), or all paths on a single plot (\code{prompt = FALSE}).}
\item{...}{Additional arguments, passed to \code{\link[prettyGraphics]{pretty_map}}, for plot customisation.}
}
\value{
The function maps the trajectories of reconstructed paths across the surface, returning a single map if \code{prompt = FALSE} or one map for each path if \code{prompt = TRUE}.
}
\description{
This function is a simple wrapper for \code{\link[prettyGraphics]{pretty_map}} that maps the paths reconstructed by a particle filtering (PF) algorithm over a surface.
}
\examples{
#### Implement pf() algorithm
# Here, we use pre-defined outputs for speed
bathy <- dat_dcpf_histories$args$bathy
paths <- dat_dcpf_paths
#### Example (1): The default implementation
pf_plot_2d(paths, bathy)
#### Example (2): Plot customisation options
# Customise the appearance of the path(s)
pf_plot_2d(paths, bathy,
add_paths = list(length = 0.075, col = viridis::viridis(100))
)
# Pass arguments to prettyGraphics::pretty_map() via ... , e.g.:
pf_plot_2d(paths, bathy, xlab = "Easting (UTM)", ylab = "Northing (UTM)")
#### Example (3): Plot individual paths separately
if (interactive()) {
pp <- graphics::par(mfrow = c(3, 4))
pf_plot_2d(paths, bathy,
add_paths = list(length = 0.01),
prompt = TRUE, verbose = FALSE
)
graphics::par(pp)
}
}
\seealso{
\code{\link[flapper]{pf}} implements the pf algorithm. \code{\link[flapper]{pf_plot_history}} visualises particle histories, \code{\link[flapper]{pf_plot_map}} creates an overall `probability of use' map from particle histories and \code{\link[flapper]{pf_simplify}} processes these into a dataframe of movement paths. \code{\link[flapper]{pf_plot_1d}}, \code{\link[flapper]{pf_plot_2d}} and \code{\link[flapper]{pf_plot_3d}} provide plotting routines for paths. For mapping, it can be useful to interpolate shortest (least-cost) paths between sequential locations via \code{\link[flapper]{lcp_interp}}. \code{\link[flapper]{pf_loglik}} calculates the log-probability of each path.
}
\author{
Edward Lavender
}