Learn R Programming

GTFSwizard (version 1.1.0)

plot_calendar: Plot Trip Frequency Calendar for GTFS Data

Description

`plot_calendar` creates a calendar heatmap visualization of the number of trips in a GTFS dataset for each day, with options for monthly and yearly faceting.

Usage

plot_calendar(gtfs, ncol = 6, facet_by_year = FALSE)

Value

A `ggplot2` object showing a calendar heatmap of the daily trip counts across the specified GTFS date range.

Arguments

gtfs

A GTFS object, ideally of class `wizardgtfs`. If not, it will be converted.

ncol

Number of columns for monthly faceting. Ignored if `facet_by_year = TRUE`.

facet_by_year

Logical value. If `TRUE`, plots data by year with each month in a separate column.

Details

- The function calculates daily trip frequencies from the `service_id` and `dates_services` tables in the GTFS object.

- Days with no trips are marked in black, while other days are shaded on a gradient from pink (low trip count) to red (high trip count).

- If `facet_by_year = TRUE`, the plot will display each year in separate rows, and `ncol` is ignored.

See Also

[GTFSwizard::as_wizardgtfs()]

Examples

Run this code
# \donttest{
# Plot a GTFS trip calendar with 4 columns
plot_calendar(for_rail_gtfs, ncol = 4)

# Plot a GTFS trip calendar, faceting by year
plot_calendar(for_rail_gtfs, facet_by_year = TRUE)
# }

Run the code above in your browser using DataLab