This is a convenience function to visualize value ranges (mean +/- std. deviation) with horizontal lines in a plot, typically one generated by iso_plot_data. Considers aesthetics color and group as well as the facet variables (if any are set) to calculate averages within each panel, color and group. This leaves the aesthetics fill and shape to be used for other purposes in displaying data points.

iso_mark_value_range(
  p,
  mean = TRUE,
  plus_minus_value = c(),
  plus_minus_sd = sd,
  sd = 1:2,
  color = NULL
)

Arguments

p

a ggplot object, typically generated by iso_plot_data

mean

logical (default TRUE), whether to show a line for the value mean

plus_minus_value

which fixed value intervals to show (mean +/- fixed), by default none are included.

plus_minus_sd

which standard deviation intervals to show (mean +/- sd), by default +/- 1 and +/-2 population std. deviations. To omit these intervals, set sd = c().

sd

renamed to the more descriptive plus_minus_sd

color

use to override inherited color aesthetics with a fixed value and thus create value ranges that average across all data points in a panel (for this to work, make sure the group aesthetic of the parent plot does NOT include the color aesthetic). Has to be a valid color string, e.g. "black" or "#ffab05". If omitted or color = NULL, the color aesthetic from the plot is inherited (the default behavior).

See also