View source: R/pf_analyse_path.R
pf_plot_2d | R Documentation |
This function is a simple wrapper for pretty_map
that maps the paths reconstructed by a particle filtering (PF) algorithm over a surface.
pf_plot_2d(
paths,
bathy,
add_bathy = list(),
add_paths = list(),
prompt = FALSE,
...
)
paths |
A dataframe containing reconstructed movement path(s) from |
bathy |
A |
add_bathy |
A named list, passed to |
add_paths |
A named list, passed to |
prompt |
A logical input that defines whether or not plot each path on a separate plot, sequentially, with a pause between plots ( |
... |
Additional arguments, passed to |
The function maps the trajectories of reconstructed paths across the surface, returning a single map if prompt = FALSE
or one map for each path if prompt = TRUE
.
Edward Lavender
pf
implements the pf algorithm. pf_plot_history
visualises particle histories, pf_plot_map
creates an overall ‘probability of use’ map from particle histories and pf_simplify
processes these into a dataframe of movement paths. pf_plot_1d
, pf_plot_2d
and pf_plot_3d
provide plotting routines for paths. For mapping, it can be useful to interpolate shortest (least-cost) paths between sequential locations via lcp_interp
. pf_loglik
calculates the log-probability of each path.
#### 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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.