plot_joint_scat {cylcop} | R Documentation |
Scatterplot of Turn Angles and Step Lengths
Description
This function produces a scatterplot ('ggplot
' object) of
the turn angles and step lengths.
Usage
plot_joint_scat(
traj = NULL,
theta = NULL,
x = NULL,
periodic = FALSE,
plot_margins = FALSE
)
Arguments
traj |
data.frame containing the trajectory produced by e.g.
|
theta |
(alternatively) numeric vector of angles (measurements of a circular variable). |
x |
(alternatively) numeric vector of step lengths (measurements of a linear variable). |
periodic |
logical value denoting whether the plot should be periodically extended past -pi and pi. |
plot_margins |
logical determining whether the marginal kernel
density estimates are computed and plotted. Alternatively, |
Details
You can either specify traj
or the angels and step lengths
(theta
and x
).
If plot_margins=T
, the code will attempt to find appropriate bandwidths for
the kernel density estimate autonomously, also taking into account computational time.
For more control over the actual method and parameters used to obtain the kernel
density estimates, you can calculate them "by hand" using e.g.
fit_angle(theta, parametric=FALSE)
and fit_steplength(x, parametric=FALSE))
.
Value
A 'ggplot
' object, the scatterplot.
References
Hodel FH, Fieberg JR (2022). “Circular-Linear Copulae for Animal Movement Data.” Methods in Ecology and Evolution. doi:10.1111/2041-210X.13821.
Hodel FH, Fieberg JR (2021). “Cylcop: An R Package for Circular-Linear Copulae with Angular Symmetry.” bioRxiv. doi:10.1101/2021.07.14.452253, https://www.biorxiv.org/content/10.1101/2021.07.14.452253v3/.
See Also
plot_cop_scat()
, plot_track()
,
plot_joint_circ()
, plot_cop_surf()
.
Examples
set.seed(123)
traj <- traj_sim(100,
copula = cyl_quadsec(0.1),
marginal_circ = list(name = "vonmises", coef = list(0, 1)),
marginal_lin = list(name = "weibull", coef = list(shape = 3))
)
plot1 <- plot_joint_scat(traj)
plot2 <- plot_joint_scat(traj, periodic = TRUE)
plot3 <- plot_joint_scat(theta=traj$angle, x=traj$steplength, periodic = TRUE, plot_margins=TRUE)
bw <- opt_circ_bw(theta = traj$angle, method = "nrd",kappa.est = "trigmoments")
ang_dens <- fit_angle(theta=traj$angle, parametric=FALSE, bandwidth=bw)
step_dens <- fit_steplength(x=traj$steplength, parametric=FALSE)
plot4 <- plot_joint_scat(traj, periodic = TRUE, plot_margins=list(ang_dens, step_dens))