
Autoplot for tariff segment objects
Source:R/gam_construct_tariff_classes.R
autoplot.tariff_segments.Rdautoplot() method for objects created by derive_tariff_segments().
Produces a ggplot2::ggplot() of the fitted GAM together with the derived
tariff segment boundaries. Optionally, confidence intervals and observed data
points
can be added.
Usage
# S3 method for class 'tariff_segments'
autoplot(
object,
confidence = FALSE,
color_gam = "steelblue",
show_observations = FALSE,
color_splits = "grey50",
size_points = 1,
color_points = "black",
rotate_labels = FALSE,
remove_outliers = NULL,
conf_int = NULL,
...
)Arguments
- object
An object of class
"tariff_segments", produced byderive_tariff_segments().- confidence
Logical, whether to plot 95% confidence intervals. Default =
FALSE.- color_gam
Color of the fitted GAM line. Default =
"steelblue".- show_observations
Logical, whether to add observed data points for each level of the risk factor. Default =
FALSE.- color_splits
Color of the vertical split lines. Default =
"grey50".- size_points
Numeric, size of points if
show_observations = TRUE. Default = 1.- color_points
Color of observed points. Default =
"black".- rotate_labels
Logical, whether to rotate x-axis labels by 45 degrees. Default =
FALSE.- remove_outliers
Numeric, exclude observations above this value from the plot (helps with extreme outliers). Default =
NULL.- conf_int
Deprecated. Use
confidenceinstead.- ...
Additional arguments passed to
ggplot2::autoplot().
Value
A ggplot2::ggplot object.