Convenience function to visualize the residuals from calibrations generated by iso_generate_calibration. Uses iso_plot_data internally and additional parameters (...) can be passed to iso_plot_data.

iso_plot_residuals(
  dt,
  x,
  y = calibration_residual(),
  calibration = last_calibration(dt),
  color = calibration_model_name(),
  panel = calibration_model_name(),
  points = TRUE,
  trendlines = TRUE,
  value_ranges = TRUE,
  ...
)

Arguments

dt

data frame to plot data from

x

the column or expression for the x-axis aesthetic. Can be a numeric, text or datetime column (text and datetime column labels will be automatically rotated by 90 degrees). For clarity of the plot, only one x variable or expression is allowed. Use named vector with c(new_x = x) to rename the x variable or expression on the fly. By default will show units in the axis names if there are any. If a datetime column is provided for x, parameters date_breaks (example: date_breaks = "2 hours") and date_labels can be set to fine-tune the x-axis appearance. See scale_date for additional details. Note that x can also be x = NULL for single data point plots - in this case the x axis is completely omitted.

y

which columns/expressions to visualize. Combine with c(y1, y2) or use select syntax (e.g. starts_with(...)) to show multiple variables in a facet_wrap. Use named vector with c(new_y1 = y1) to rename variables/expressions on the fly. By default will show units in the axis names if there are any.

color

variable to use for color aesthetic for the plot or constant value for the point and line color

panel

whether to panel the data by anything. If using a single parameter (e.g. panel = panel), will generate a facet_wrap. If using a formula (e.g. panel = panel ~ . or panel = file_id ~ panel), will generate a facet_grid. The default for this parameter is to panel via facet grid by the y variable name but only if multiple y columns are provided. Otherwise will not generate any facets. If additional facet parameters are desired, please leave use facet_wrap and facet_grid diretly.

points

whether to plot points (FALSE by default)

trendlines

whether to add trendlines to the residuals plot to highlight patterns more easily. To customize more, set trendlines=FALSE and provide a manual geom_smooth() in the ... of this function.

value_ranges

whether to add value ranges (via iso_mark_value_range) to the plot to highlight residuals variation. To customize more, set value_ranges=FALSE and add ranges back in using iso_mark_value_range directly.

...

additional parameters passed to iso_plot_data

See also