Learn R Programming

circular (version 0.5-1)

plot.density.circular: Plot Method for Kernel Density Estimation for Circular Data

Description

The plot method for density.circular objects.

Usage

# S3 method for density.circular
plot(x, main=NULL, sub=NULL, xlab=NULL, ylab="Density circular", type="l",
  zero.line=TRUE, points.plot=FALSE, points.col=1, points.pch=1, 
  points.cex=1, plot.type=c("circle", "line"), axes=TRUE, ticks=FALSE, 
  bins=NULL, offset=1, shrink=1, tcl=0.025, tcl.text = 0.125, sep=0.025, tol=0.04, 
  digits=2, cex=1, uin=NULL, xlim=NULL, ylim=NULL, join=FALSE, nosort=FALSE, 
  units=NULL, template=NULL, zero=NULL, rotation=NULL, 
  control.circle=circle.control(), ...)

Value

A list with information on the plot: zero, rotation and next.points.

Arguments

x

an object of class density.circular.

main, sub, xlab, ylab, type

plotting parameters with useful defaults.

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: "line": linear plot, "circle": circular plot.

axes

logical; if TRUE axis are drawn.

ticks

logical; if TRUE ticks are drawn.

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.

tcl.text

The position of the axis labels.

sep

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

tol

proportion of white space at the margins of plot

digits

number of digits used to print axis values.

cex

point character size. See help on par.

uin

desired values for the units per inch parameter. If of length 1, the desired units per inch on the x axis.

xlim, ylim

the ranges to be encompassed by the x and y axes. Useful for centering the plot.

join

logical: should the first and the last point joined.

nosort

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

units

units measure used in the plot. If NULL the value is taken from the attribute of object 'x' from the argument 'x', i.e. x$x.

template

template used in the plot. If NULL the value is taken from the attribute of object 'x' from the argument 'x', i.e. x$x.

zero

position of the zero used in the plot. If NULL the value is taken from the attribute of object 'x' from the argument 'x', i.e. x$x.

rotation

rotation used in the plot. If NULL the value is taken from the attribute of object 'x' from the argument 'x', i.e. x$x.

control.circle

parameters passed to plot.default in order to draw the circle. The function circle.control is used to set the parameters.

...

further parameters passed to plot.default.

Author

Claudio Agostinelli

See Also

density.circular, lines.density.circular, plot.circular, lines.circular and curve.circular.

Examples

Run this code

set.seed(1234)
x <- rvonmises(n=100, mu=circular(pi), kappa=2)
res25x <- density(x, bw=25)
plot(res25x, points.plot=TRUE, xlim=c(-1.5,1))
res50x <- density(x, bw=25, adjust=2)
lines(res50x, col=2)

resp25x <- plot(res25x, points.plot=TRUE, xlim=c(-1, 1.3), ylim=c(-1.5,1.2), 
  template="geographics", main="Plotting density estimate for two data set")
y <- rvonmises(n=100, mu=circular(pi/2), kappa=2, 
  control.circular=list(template="geographics"))
res25y <- density(y, bw=25)
lines(res25y, points.plot=TRUE, plot.info=resp25x, col=2, points.col=2)

plot(res25x, plot.type="line", points.plot=TRUE, xlim=c(-1, 1.3), ylim=c(-1.5,1.2), 
  template="geographics", main="Plotting density estimate for two data set")
lines(res25y, plot.type="line", points.plot=TRUE, col=2, points.col=2)

Run the code above in your browser using DataLab