shade_confidence_interval() plots confidence interval region on top of the visualize() output. It should be used as {ggplot2} layer function (see examples). shade_ci() is its alias.

shade_confidence_interval(endpoints, color = "mediumaquamarine",
  fill = "turquoise", ...)

shade_ci(endpoints, color = "mediumaquamarine", fill = "turquoise",



A 2 element vector or a 1 x 2 data frame containing the lower and upper values to be plotted. Most useful for visualizing conference intervals.


A character or hex string specifying the color of the end points as a vertical lines on the plot.


A character or hex string specifying the color to shade the confidence interval. If NULL then no shading is actually done.


Other arguments passed along to {ggplot2} functions.


A list of {ggplot2} objects to be added to the visualize() output.

See also

shade_p_value() to add information about p-value region.


viz_plot <- mtcars %>% dplyr::mutate(am = factor(am)) %>% specify(mpg ~ am) %>% # alt: response = mpg, explanatory = am hypothesize(null = "independence") %>% generate(reps = 100, type = "permute") %>% calculate(stat = "t", order = c("1", "0")) %>% visualize(method = "both")
#> Warning: Check to make sure the conditions have been met for the theoretical method. {infer} currently does not check these for you.
viz_plot + shade_confidence_interval(c(-1.5, 1.5))
viz_plot + shade_confidence_interval(c(-1.5, 1.5), fill = NULL)