View source: R/plotting_functions.R
plot_joint_scat | R Documentation |
This function produces a scatterplot ('ggplot
' object) of
the turn angles and step lengths.
plot_joint_scat( traj = NULL, theta = NULL, x = NULL, periodic = FALSE, plot_margins = FALSE )
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, |
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))
.
A 'ggplot
' object, the scatterplot.
Hodelapplcylcop
\insertRefHodelmethodcylcop
plot_cop_scat()
, plot_track()
,
plot_joint_circ()
, plot_cop_surf()
.
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.