Visualise an "RatioFit" object as a triangle-style heatmap of
cumulative loss ratios. Observed and projected cells are
distinguished by border style.
Usage
# S3 method for class 'RatioFit'
plot_triangle(
x,
metric = c("ratio", "loss", "premium"),
cell_type = c("cumulative", "incremental"),
region = c("proj", "full", "data"),
view = c("value", "usage"),
label_style = c("value", "detail"),
label_size = NULL,
show_maturity = TRUE,
digits = 0,
amount_divisor = "auto",
theme = c("view", "save", "shiny"),
nrow = NULL,
ncol = NULL,
...
)Arguments
- x
An object of class
"RatioFit".- metric
Metric shown in the heatmap cells. One of
"ratio"(default),"loss","premium".- cell_type
Aggregation. One of
"cumulative"(default) or"incremental". Combined withmetricto select the column (e.g.,metric = "ratio",cell_type = "incremental"->incr_ratio).- region
Cell region to plot (only used when
view = "value"). One of"proj"(projected cells only, observed cells masked),"full"(observed + projected), or"data"(observed cumulative loss / premium / ratio fromx$data– the raw Triangle, no projection). Default is"proj".- view
Plot mode. One of:
- "value" (default)
Per-cell
ratioheatmap with column-wise relative fill.regionselects which cells to display.- "usage"
Cell-status heatmap (
used/holdout/unused/future) driven by the fit's own metadata (x$recent,x$loss_regime,x$maturity).regionis ignored.
- label_style
One of
"value"(ratio only) or"detail"(ratio with loss/premium amounts). Default is"value".- label_size
Numeric size of the in-cell text label. Defaults to
3forlabel_style = "value"and2.5forlabel_style = "detail"(two-line labels).- show_maturity
Logical; if
TRUE, show maturity line. Default isTRUE.- digits
Number of decimal places for ratio display. Default is
0.- amount_divisor
Numeric divisor for amount display in
"detail"mode. Default is1e8.- theme
Theme string.
- nrow, ncol
Facet dimensions.
- ...
Additional arguments passed to
.switch_theme().
