View source: R/pf_analyse_path.R
pf_plot_3d | R Documentation |
This function is a simple wrapper for pretty_scape_3d
that maps the paths reconstructed by the depth-contour or acoustic-container depth-contour particle filtering algorithms (DCPF and ACDCPF) over a surface in three dimensions.
pf_plot_3d(
paths,
bathy,
add_paths = list(line = list(width = 10)),
shift = 5,
stretch = -5,
aspectmode = "data",
prompt = FALSE,
...
)
paths |
A dataframe containing reconstructed movement path(s) from |
bathy |
A |
add_paths |
A named list, passed to |
shift |
A number that vertically shifts the paths above the surface ( |
stretch |
A number that vertically stretches the height of the surface (see |
aspectmode |
A character that defines the shape of the plot: |
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 |
This function requires the plotly
package.
The function maps the trajectories of reconstructed paths across the bathymetry surface in three-dimensions, returning a single map if prompt = FALSE
or one map for each path if prompt = TRUE
. The function also invisibly returns the plot object, if prompt = TRUE
, or a list of plot objects, if prompt = FALSE
(with one element for each path), to facilitate further modification.
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
# Note that it may be beneficial to interpolate paths between points
# ... e.g., via lcp_interp() prior to plotting, but we will not do that here.
bathy <- dat_dcpf_histories$args$bathy
paths <- dat_dcpf_paths
#### Example (1): Visualise paths using the default options
pf_plot_3d(paths, bathy)
#### Example (2): Customise the plot
# Customise via add_paths() list
pf_plot_3d(paths, bathy,
add_paths = list(
line = list(color = "black", width = 10),
marker = list(color = "blue", size = 10)
)
)
# Adjust shift, stretch or aspectmode
pf_plot_3d(paths, bathy, shift = 200, stretch = -10)
# Customise via ... e.g., add coastline:
coast <- raster::crop(dat_coast, bathy)
pf_plot_3d(paths, bathy, coastline = coast)
# The returned plot objects can also be used for further customisation.
#### Example (3): Plot individual paths separately
if (interactive()) {
pf_plot_3d(paths, bathy, prompt = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.