cdensity {cplots} | R Documentation |
Circular Density Curve
Description
Function cdensity
can be used to plot 2-dimensional
density curves for circular data.
Usage
cdensity(
f,
radius = 1/sqrt(base::pi),
area.prop = TRUE,
total.area = 1,
nlabels = 4,
add = FALSE,
n = 500,
col = "red",
xlim = NULL,
ylim = NULL,
main = NULL
)
Arguments
f |
an R function that is to be plotted as a circular density or frequency. |
radius |
the radius of the reference circle. If |
area.prop |
logical; if |
total.area |
a positive number specifying the total area under the
density curve. If |
nlabels |
integer, for the number of levels to be plotted; if
|
add |
logical; if |
n |
the number of points to plot the density curve. |
col |
the color of the density line. |
xlim |
numeric vectors of length 2, giving the x coordinates ranges. |
ylim |
numeric vectors of length 2, giving the y coordinates ranges. |
main |
the main title (on top) |
Value
No return value
Author(s)
Danli Xu <dxu452@aucklanduni.ac.nz>, Yong Wang <yongwang@auckland.ac.nz>
References
Xu, D. and Wang, Y. (2020). Area-proportional Visualization for Circular Data. Journal of Computational and Graphical Statistics, 29, 351-357.
See Also
Examples
# 600 observations from two von Mises distributions
library(circular)
x = c(rvonmises(200, circular(pi/4), 5), rvonmises(400, circular(pi), 20))
dvm = function(x, mu=0, kappa=1) # von Mises density
exp(kappa * cos(x - mu)) * (2 * pi * besselI(kappa, 0))^(-1)
f = function(x) 1/3 * dvm(x, pi/4, 5) + 2/3 * dvm(x, pi, 20)
cdensity(f) # plot the density in an area-proportional manner
chist(x) # circular histogram
cdensity(f, add=TRUE) # superimpose the density curve
chist(x, area=FALSE) # height-proportional circular histogram
cdensity(f, area=FALSE, add=TRUE) # superimpose the density curve
chist(x, radius=0) # rose diagrams
cdensity(f, radius=0, add=TRUE)
chist(x, radius=0, area=FALSE)
cdensity(f, radius=0, area=FALSE, add=TRUE)