Skip to contents

A circular plot useful for visualising monthly or weekly data.

Usage

plotCircular(
  data = NULL,
  type = "monthly",
  time = NULL,
  areas = NULL,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  clockwise = TRUE,
  legend = "bottom",
  spoke.col = NULL,
  pieces.col = NULL
)

Arguments

data

Dataset to use for plot as a data.frame.

type

type of data to plot, either "monthly" or "weekly", default:monthly.

time

time variable in the data, typically month or day of the week.

areas

variable(s) to plot, the area of the segments (or petals) are proportional to this variable.

main

title for plot, default:blank

xlab

x axis label, default:blank

ylab

y axis label, default:blank

clockwise

plot in a clockwise direction, default:TRUE.

legend

Where to plot legend, only relevant if two variables. Default is "bottom". See ggplot2::guide_legend() for details, specifically "position". Set to "none" for no legend. Options are: "top", "right", "bottom", "left", or "inside".

spoke.col

spoke colour, default:black.

pieces.col

colours for circular pieces, default:"white" for 1st and "grey" for second variable. Note that a list of available colours may be found with colours().

Value

a circular plot in ggplot2 format, also known as "rosebud", and "nightingale" plots.

Details

A circular plot can be useful for spotting the shape of the seasonal pattern. This function can be used to plot any circular patterns, e.g., weekly or monthly. The method assumes that monthly data starts in January and weekly data starts on Monday.

The plots are also called rose diagrams, with the segments then called "petals".

References

Fisher, N.I. (1993) Statistical Analysis of Circular Data. Cambridge University Press, Cambridge.

Author

Adrian Barnett a.barnett@qut.edu.au

Examples

## Monthly numbers of AFL players
AFL.frame = data.frame(AFL[c("month", "players", "expected")])
aplot1 = plotCircular(
 data = AFL.frame,
 time = "month",
 areas = "players",
 legend = "none")
## The observed and expected number of players per month
aplot = plotCircular(
data = AFL.frame,
time = "month",
areas = c("players", "expected"))
## Creating weekly data as an example
weekfreq <- data.frame(day = 1:7, counts = rpois(n = 7, lambda = 5))
wplot = plotCircular(
 data = weekfreq,
 time = "day",
 type = "weekly",
 areas = "counts",
 legend = "none")