Skip to contents

Draws a Timeseries Scatterplot

Usage

draw_timeseries_scatterplot(
  data,
  y_var,
  grouping_var_1,
  grouping_var_1_type = "date-time",
  grouping_var_2,
  faceting = FALSE,
  limits = FALSE,
  date_breaks = "1 month",
  date_labels = "%b %y",
  analysis_desc_label = NULL,
  x_axis_text_size = 11,
  point_size = 1,
  alpha = 0.3,
  line_size = 1,
  interactive = TRUE
)

Arguments

data

input dataset to be plotted (required)

y_var

Y variable to be plotted on Y axis (required)

grouping_var_1

Time variable to be plotted on x axis (required)

grouping_var_1_type

Time variable type. Options are "date-time" or "factor"

grouping_var_2

Additional variable for faceting (optional)

faceting

Set whether to display each group in a separate plot. By default, it is set to FALSE (optional)

limits

Logical. If TRUE, process behavior chart control limits for the individual group means are plotted. By default, it is set to FALSE (optional)

date_breaks

Set date breaks. Takes a string, for example "1 week" or "2 days". By default, it is set to "1 month" (optional)

date_labels

Set date labels. Identical to the date labels argument of the scale_x_date() ggplot function (optional)

analysis_desc_label

Label (subtitle) for analysis description. By default, it is set to NULL (optional)

x_axis_text_size

X axis text size. By default, it is set to 11. (optional)

point_size

Set point size. By default, it is set to 1 (optional)

alpha

Set transparency for individual observations. Identical to the alpha ggplot argument. By default, it is set to 0.3 (optional)

line_size

Set line size. By default, it is set to 1 (optional)

interactive

Set plot interactivity. By default, it is set to TRUE (optional)

Value

A 'ggplot' or 'plotly' object

Examples

timeseries_scatterplot_data %>%
   draw_timeseries_scatterplot(y_var = y,
                               grouping_var_1 = date,
                               grouping_var_2 = cavity,
                               faceting       = TRUE,
                               limits         = TRUE,
                               alpha          = 0.15,
                               line_size      = 0.5,
                               x_axis_text    = 7,
                               interactive    = FALSE)
#> Joining, by = c("date", "cavity")
#> Warning: Removed 6 rows containing missing values (`geom_point()`).