facet_calendar {sugrrants} | R Documentation |
Lay out panels in a calendar format
Description
Lay out panels in a calendar format
Usage
facet_calendar(
date,
format = "%b %d",
week_start = getOption("lubridate.week.start", 1),
nrow = NULL,
ncol = NULL,
scales = "fixed",
shrink = TRUE,
dir = "h",
labeller = "label_value",
strip.position = "top"
)
Arguments
date |
A variable that contains dates or an expression that generates dates will be mapped in the calendar. |
format |
A character string, such as |
week_start |
Day on which week starts following ISO conventions -
1 means Monday (default), 7 means Sunday. You can set |
nrow , ncol |
Number of rows and columns defined for "monthly" calendar
layout. If |
scales |
Should scales be fixed ( |
shrink |
If |
dir |
Direction of calendar: "h" for horizontal (the default) or "v" for vertical. |
labeller |
A function that takes one data frame of labels and
returns a list or data frame of character vectors. Each input
column corresponds to one factor. Thus there will be more than
one with |
strip.position |
By default, the labels are displayed on the top of
the plot. Using |
Details
A monthly calendar is set up as a 5 by 7 layout matrix. Each month could extend over six weeks but in these months is to wrap the last few days up to the top row of the block.
See Also
frame_calendar for a compact calendar display, by quickly transforming the data.
Examples
fs <- hourly_peds %>%
dplyr::filter(Date < as.Date("2016-05-01"))
fs %>%
ggplot(aes(x = Time, y = Hourly_Counts)) +
geom_line(aes(colour = Sensor_Name)) +
facet_calendar(~ Date, nrow = 2) + # or ~ as.Date(Date_Time)
theme(legend.position = "bottom")