lines.density.circular: Add a Plot for Kernel Density Estimation for Circular Data

View source: R/density.circular.R

lines.density.circularR Documentation

Add a Plot for Kernel Density Estimation for Circular Data

Description

The lines add a plot for density.circular objects.

Usage

## S3 method for class 'density.circular'
lines(x, type = "l", zero.line = TRUE,
  points.plot = FALSE, points.col = 1, points.pch = 1, points.cex = 1,
  plot.type = c("circle", "line"), bins = NULL, offset=1, shrink = 1,
  tcl = 0.025, sep = 0.025, join = TRUE, nosort = FALSE,
  plot.info = NULL, zero = NULL, rotation = NULL, ...)

Arguments

x

an object of class density.circular.

type

plotting parameter with useful default.

zero.line

logical; if TRUE, add a base line at y = 0. Used when plot.type is "line".

points.plot

logical; if TRUE original data are added to the plot.

points.col, points.pch, points.cex

parameters used to draw the points.

plot.type

type of the plot.

bins

number of ticks to plot.

offset

the radius of the circle

shrink

parameter that controls the size of the plotted function. Default is 1.

tcl

length of the ticks.

sep

constant used to specify the distance between stacked points. Default is 0.025; smaller values will create smaller spaces.

join

logical: should the first and the last point joined.

nosort

logical: should the data sort before plotting. Defaults is to sort.

plot.info

an object from plot.circular that contains information on the zero, the rotation and next.points.

zero

the zero of the plot. Ignored if plot.info is provided.

rotation

the rotation of the plot. Ignored if plot.info is provided.

...

further parameters passed to lines.default.

Value

A list with information on the plot: zero, rotation and next.points and, if available, the coordinates x and y.

Author(s)

Claudio Agostinelli

See Also

density.circular and plot.density.circular

Examples

set.seed(1234)
x <- rvonmises(n=100, mu=circular(pi), kappa=2)
y <- rvonmises(n=100, mu=circular(pi/2), kappa=2)
resx <- density(x, bw=25)
res <- plot(resx, points.plot=TRUE, xlim=c(-1.5,1), ylim=c(-1.1, 1.5))
resy <- density(y, bw=25)
lines(resy, points.plot=TRUE, col=2, points.col=2, plot.info=res)

circular documentation built on Sept. 11, 2024, 8:21 p.m.