plot_scatter_by_facility_over_time: Create facets with scatters over time

View source: R/plots.R

plot_scatter_by_facility_over_timeR Documentation

Create facets with scatters over time

Description

This function creates a scatter plot with multiple facets, where each facet represents a facility or location. The plot is organized over time, with the x-axis representing dates and the y-axis representing values from a specified column in the data frame.

Usage

plot_scatter_by_facility_over_time(
  df,
  facility_col,
  date_col,
  date_lbl,
  date_break_str,
  date_format,
  start_date,
  end_date,
  y_col,
  y_lbl,
  y_is_time = FALSE,
  time_break_str = "",
  time_format = "",
  y_min = NA,
  y_max = NA,
  n_facet_per_row = 5,
  text_size = 7
)

Arguments

df

A data frame containing the data to be plotted.

facility_col

The name of the column in df that represents the facilities

date_col

Column name in data frame 'df', should contain dates.

date_lbl

String that contains the x-axis label for the plot.

date_break_str

A string giving the distance between date breaks like "2 weeks", or "10 years".

date_format

A string giving the date formatting specification for the date labels (for instance '%b%y').

start_date

Minimal value in the date range.

end_date

Maximal value in the date range.

y_col

Column name in data frame 'df'.

y_lbl

String that contains the y-axis label for the plot.

y_is_time

Boolean (optional, default 'FALSE').

time_break_str

A string giving the distance between time breaks like "4 hours" (optional, default "").

time_format

A string giving the date formatting specification for the time labels, for instance '%H:%M' (optional, default "").

y_min

Minimum value of the y-axis (optional, default 'NA').

y_max

Maximum value of the y-axis (optional, default 'NA').

n_facet_per_row

Numeric value (optional, default 5) to set the number of facets per rows.

text_size

Numeric value (optional, default 7) to scale the text size.

Value

This function returns a ggplot2 object.


Thaliehln/timci documentation built on April 8, 2024, 3:38 p.m.