# 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)
# Examples on using radii.scale and prop with a dummy dataset where
# highest proportion is 50% in bin 2
x <- c(2, 2, 2, 2, 5, 5, 10, 20)
circ.x <- circular::circular(x, units = "hours", template = "clock24")
old_par <- par(mfrow = c(2, 2))
rose.diag(circ.x, bins=24, main="radii.scale=linear, prop=1",
radii.scale="linear", prop=1)
rose.diag(circ.x, bins=24, main = "radii.scale=linear, prop=2",
radii.scale="linear", prop=2)
rose.diag(circ.x, bins=24, main = "radii.scale=sqrt, prop=1",
radii.scale="sqrt", prop=1)
rose.diag(circ.x, bins=24, main = "radii.scale=sqrt, prop=sqrt(2)",
radii.scale="sqrt", prop=sqrt(2))
par(old_par)
Run the code above in your browser using DataLab