| add_line | R Documentation | 
add_line() and add_area() connect individual data points, which is rarely needed.
In most cases, you are probably looking for add_sum_line(), add_mean_line(), add_sum_area() or add_mean_area().
add_line(
  plot,
  group,
  dodge_width = NULL,
  linewidth = 0.25,
  preserve = "total",
  ...
)
add_area(
  plot,
  group,
  dodge_width = NULL,
  linewidth = 0.25,
  alpha = 0.4,
  preserve = "total",
  ...
)
| plot | A  | 
| group | Variable in the dataset to be used for grouping. | 
| dodge_width | For adjusting the distance between grouped objects. Defaults
to  | 
| linewidth | Thickness of the line in points (pt). Typical values range between  | 
| preserve | Should dodging preserve the  | 
| ... | Arguments passed on to the  | 
| alpha | A  | 
A tidyplot object.
# Paired data points
study |>
  tidyplot(x = treatment, y = score, color = group) |>
  reorder_x_axis_labels("A", "C", "B", "D") |>
  add_data_points() |>
  add_line(group = participant, color = "grey")
study |>
  tidyplot(x = treatment, y = score) |>
  reorder_x_axis_labels("A", "C", "B", "D") |>
  add_data_points() |>
  add_area(group = participant)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.