Learn R Programming

tidyplots (version 0.2.2)

add_sem_ribbon: Add ribbon

Description

  • add_sem_ribbon() adds the standard error of mean.

  • add_range_ribbon() adds the range from smallest to largest value.

  • add_sd_ribbon() adds the standard deviation.

  • add_ci95_ribbon() adds the 95% confidence interval.

Usage

add_sem_ribbon(plot, dodge_width = NULL, alpha = 0.4, color = NA, ...)

add_range_ribbon(plot, dodge_width = NULL, alpha = 0.4, color = NA, ...)

add_sd_ribbon(plot, dodge_width = NULL, alpha = 0.4, color = NA, ...)

add_ci95_ribbon(plot, dodge_width = NULL, alpha = 0.4, color = NA, ...)

Value

A tidyplot object.

Arguments

plot

A tidyplot generated with the function tidyplot().

dodge_width

For adjusting the distance between grouped objects. Defaults to 0.8 for plots with at least one discrete axis and 0 for plots with two continuous axes.

alpha

A number between 0 and 1 for the opacity of an object. A value of 0 is completely transparent, 1 is completely opaque.

color

A hex color for the stroke color. For example, "#FFFFFF" for white.

...

Arguments passed on to the geom function.

Examples

Run this code
# Standard error of the mean
time_course |>
  tidyplot(x = day, y = score, color = treatment) |>
  add_mean_line() |>
  add_sem_ribbon()

# Range from minimum to maximum value
time_course |>
  tidyplot(x = day, y = score, color = treatment) |>
  add_mean_line() |>
  add_range_ribbon()

# Standard deviation
time_course |>
  tidyplot(x = day, y = score, color = treatment) |>
  add_mean_line() |>
  add_sd_ribbon()

# 95% confidence interval
time_course |>
  tidyplot(x = day, y = score, color = treatment) |>
  add_mean_line() |>
  add_ci95_ribbon()

# Changing arguments: alpha
time_course |>
  tidyplot(x = day, y = score, color = treatment) |>
  add_mean_line() |>
  add_sem_ribbon(alpha = 0.7)

Run the code above in your browser using DataLab