View source: R/ct_plot_rose_diagram.R
| ct_plot_rose_diagram | R Documentation |
This function generates a rose diagram (circular bar plot) to visualize daily activity patterns over a 24-hour period. Each bar represents either the absolute or relative frequency of observations within hourly intervals. The plot also includes a segment indicating the mean activity time, and an optional segment showing the 95% confidence interval of the activity period.
ct_plot_rose_diagram(
data = NULL,
times,
frequencies = "absolute",
hide_lebels = FALSE,
label_position = NULL,
label_style = list(),
time_range = 1,
ci_segment = TRUE,
mean_segment = TRUE,
ring = TRUE,
color = "gray20",
fill = color,
ci_style = list(),
mean_style = list(),
start = -0.12,
width = NULL
)
data |
A data frame containing the time values. If |
times |
A numeric vector of time values (in radians) or a column name from |
frequencies |
Character. Use |
hide_lebels |
Logical. If |
label_position |
Numeric. Controls vertical position of the frequency value labels (if shown). |
label_style |
A list of styles for labels. Accepts |
time_range |
Numeric. Width of the time bins in hours. Default is |
ci_segment |
Logical or numeric. If |
mean_segment |
Logical. If |
ring |
Logical or numeric vector. If |
color |
Color of the bar border and segments. Default is |
fill |
Fill color of the bars. Default is the same as |
ci_style |
A list of styles for the confidence interval segment. Accepts |
mean_style |
A list of styles for the mean segment. Accepts |
start |
Numeric. The angle (in radians) where the polar plot starts. Default is |
width |
Numeric. Width of each bar. Default is |
A ggplot object representing the rose diagram.
set.seed(129)
library(dplyr)
library(ggplot2)
rf <- runif(123, 0, max = 6)
ct_plot_rose_diagram(data = NULL,
times = rf,
frequencies = "relative",
label_style = list(size = 4, color = 'red'),
label_position = 11,
time_range = 1,
mean_segment = TRUE,
ci_segment = 1,
ring = c(-5, 12),
color = 'gray20',
mean_style = list(linetype = 1, linewidth = .5, color = 'red'),
ci_style = list(linetype = 1, linewidth = .5, color = 'black')
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.