Learn R Programming

circular (version 0.3-7)

rose.diag: Rose Diagram

Description

Creates a rose diagram of a circular data set on the current graphics device.

Usage

rose.diag(x, pch = 16, cex = 1, axes = TRUE, shrink = 1, bins = NULL, 
     ticks = TRUE, tcl = 0.025, tcl.text = 0.125, col = NULL, tol = 0.04, uin = NULL, 
     xlim = c(-1, 1), ylim = c(-1, 1), prop = 1, digits = 2, plot.info = NULL, 
     units = NULL, template = NULL, zero = NULL, rotation = NULL, 
     main = "", xlab = "", ylab = "", add = FALSE, ...)

Arguments

x
a vector, matrix or data.frame. The object is coerced to class circular.
pch
point character to use. See help on par.
cex
point character size. See help on par.
axes
logical: if TRUE axes are plotted according to properties of x.
shrink
parameter that controls the size of the plotted circle. Default is 1. Larger values shrink the circle, while smaller values enlarge the circle.
bins
number of arcs to partition the circle with.
ticks
logical: if TRUE ticks are plotted according to the value of bins.
tcl
length of the ticks.
tcl.text
The position of the axis labels.
col
color of the points. The values are recycled if needed.
tol
proportion of white space at the margins of plot.
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.
prop
numerical constant determining the radii of the sectors. By default, prop = 1.
digits
number of digits used to print axis values.
plot.info
an object from plot.circular that contains information on the zero, the rotation and next.points.
units
the units used in the plot. If NULL the units of the first component of 'x' is used.
template
the template of the plot. Ignored if plot.info is provided.
zero
the zero of the plot. Ignored if plot.info or template are provided.
rotation
the rotation of the plot. Ignored if plot.info or template are provided.
main, xlab, ylab
title, x label and y label of the plot.
add
add the rose diag to an existing plot.
...
futher parameters passed to lines.default.

Value

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

Details

The circumference of the circle is split into groups, the number of groups specified by bins. For each group, a sector is drawn. The radii of the sectors are by default equal to the square root of the relative frequencies of observations in each group. This ensures that the area of the sector is proportional to the group frequency. The length of the radii can be controlled by varying the parameter prop.

See Also

plot.circular

Examples

Run this code
# Generate uniform data and create several rose diagrams.  
# Some optional parameters may be needed to optimize plots.
x <- circular(runif(50, 0, 2*pi))
rose.diag(x, bins = 18, main = 'Uniform Data')
points(x)

# Generate von Mises data and create several rose diagrams.
x <- rvonmises(n=50, mu=circular(0), kappa=5, control.circular=list(zero=pi/4))
y <- rose.diag(x, bins=18) # Points fall out of bounds.
points(x, plot.info=y, stack=TRUE)
y <- rose.diag(x, bins=18, prop=1.5, shrink=1.5) # Adjust optional parameters to fit all points on plot.
points(x, plot.info=y, stack=TRUE)

# Add the rose diag to a plot

plot(x)
rose.diag(x, bins=12, add=TRUE, col=2)

Run the code above in your browser using DataLab