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 radius = 0, no reference circle is produced, and the centre presents the point with zero density.

area.prop

logical; if TRUE, an area-proportional transformation is applied; if FALSE, a height-proportional transformation is applied.

total.area

a positive number specifying the total area under the density curve. If total.area = NULL, no scaling is applied, the plot is in the original scale. If area.prop = TRUE, the total area is automatically unity without scaling.

nlabels

integer, for the number of levels to be plotted; if 0, no label is plotted.

add

logical; if TRUE, the density curve is superimposed to the current plot, for example, a circular histogram, a rose diagram or a stacked dot plot that has been produced in a similar manner.

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

cbarplot, cdotplot, chist

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)


[Package cplots version 0.5-0 Index]