Generates a Gantt chart showing the schedule of pile-driving activities at selected wind farm sites.

create_gantt(
  project,
  spots = NULL,
  by_date = FALSE,
  exact_date = FALSE,
  project_start_date = Sys.Date(),
  project_end_date = Sys.Date() + 365,
  colour_palette = wesanderson::wes_palette("Darjeeling1"),
  font_family = "sans",
  mark_quarters = FALSE,
  mark_years = FALSE,
  size_wp = 6,
  hide_wp = FALSE,
  size_activity = 4,
  size_text_relative = 1,
  label_wrap = FALSE,
  month_number_label = TRUE,
  month_date_label = TRUE,
  x_axis_position = "top",
  colour_stripe = "lightgray",
  alpha_wp = 1,
  alpha_activity = 1,
  line_end = "round",
  month_breaks = 1,
  show_vertical_lines = TRUE,
  axis_text_align = "right"
)

Arguments

project

A data.frame object. See test_project for an example.

spots

A data.frame object. See test_spots for an example.

by_date

Logical. If FALSE, the start and end columns in the data.frame should correspond to month numbers from the beginning of the project. If TRUE, dates in the format ("2020-10" or "2020-10-01") should be given. Defaults to FALSE.

exact_date

Logical. If FALSE, then periods are always understood to include full months. If TRUE, then exact dates can be given. Defaults to FALSE.

project_start_date

The date when the project starts. Can be a date, or a string in the format "2020-03" or "2020-03-01".

project_end_date

The date when the project ends. Can be a date, or a string in the format "2020-03" or "2020-03-01".

colour_palette

A character vector of colours or a colour palette.

font_family

A character vector of length 1. Defaults to "sans". It is recommended to use a narrow/condensed font such as Roboto Condensed for more efficient use of text space.

mark_quarters

Logical. If TRUE, vertical lines are added in correspondence of change of quarter (end of March, end of June, end of September, end of December). Defaults to FALSE.

mark_years

Logical. If TRUE, vertical lines are added in correspondence of change of year (1 January). Defaults to FALSE.

size_wp

Numeric. Defines the thickness of the line used to represent WPs. Defaults to 6.

hide_wp

Logical. If TRUE, the lines of the WP are hidden and only activities are shown. Defaults to FALSE.

size_activity

Numeric. It defines the thickness of the line used to represent activities. Defaults to 4.

size_text_relative

Numeric. Changes the size of all textual elements relative to their default size. For example, if set this to 1.5 all text elements will be 50% bigger. Defaults to 1.

label_wrap

Logical. If given, must be numeric, referring to the number of characters per line allowed in the labels of projects and activities, or logical (if set to TRUE, it will default to 32). To be used when labels would otherwise be excessively long. Defaults to FALSE.

month_number_label

Logical. If TRUE, month numbering is included on the x-axis. Defaults to TRUE.

month_date_label

Logical. If TRUE, month names and dates are included on the x-axis. Defaults to TRUE.

x_axis_position

Character. Defaults to "top". Can also be "bottom". Used only when one of 'month_number_label' and 'month_date_label' is TRUE, otherwise ignored.

colour_stripe

Character. Defaults to "lightgray". This is the stripe colour in the background used in alternate months.

alpha_wp

Numeric. Controls transparency of the line used to represent WPs. Defaults to 1.

alpha_activity

Numeric. Controls transparency of the line used to represent activities. Defaults to 1.

line_end

Character. Defaults to "round". One of "round", "butt", "square". Controls line ends.

month_breaks

Numeric. Defines if labels for all months are shown or only once every x months. Useful for longer projects. Defaults to 1.

show_vertical_lines

Logical. If set to FALSE, it hides the thin vertical lines corresponding to month numbers. Useful in particular for longer projects. Defaults to TRUE.

axis_text_align

Character. Defaults to "right". Defines alignment of text on the y-axis is left. Accepted values are "left", "right", "centre", or "center".

Value

A Gantt chart as a ggplot2 object.

See also

Adapted from ganttrify.

Author

Phil J. Bouchet