Function cdensity
can be used to plot 2-dimensional
density curves for circular data.
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
)
an R function that is to be plotted as a circular density or frequency.
the radius of the reference circle. If radius = 0
,
no reference circle is produced, and the centre presents the point
with zero density.
logical; if TRUE
, an area-proportional
transformation is applied; if FALSE
, a height-proportional
transformation is applied.
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.
integer, for the number of levels to be plotted; if
0
, no label is plotted.
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.
the number of points to plot the density curve.
the color of the density line.
numeric vectors of length 2, giving the x coordinates ranges.
numeric vectors of length 2, giving the y coordinates ranges.
the main title (on top)
No return value
Xu, D. and Wang, Y. (2020). Area-proportional Visualization for Circular Data. Journal of Computational and Graphical Statistics, 29, 351-357.
# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab