S3 plot method for pigauto_pred objects, using base R
graphics. Three plot types are available: scatter plots of observed
vs predicted values, interval plots per species, and probability
charts for discrete traits.
Usage
# S3 method for class 'pigauto_pred'
plot(x, data = NULL, splits = NULL, type = "scatter", trait = NULL, ...)Arguments
- x
An object of class
"pigauto_pred".- data
Optional numeric matrix or data.frame of observed values in original scale. When supplied, observed values are overlaid on scatter and interval plots.
- splits
Optional list (output of
make_missing_splits). Used to identify which cells were held out for evaluation.- type
Character.
"scatter"(default): grid of observed-vs-predicted scatter plots for continuous, count, and proportion traits, with 1:1 line and conformal interval bands where available."intervals": for each trait, species sorted by predicted value with conformal-interval ribbon; observed values shown in red where available."probabilities": for binary traits, boxplot of predicted probabilities grouped by true class; for categorical traits, stacked bar chart of mean predicted probabilities by true class.- trait
Character vector of trait names to plot. If
NULL(default), all traits appropriate for the chosentypeare plotted.- ...
Additional arguments passed to base plotting functions.
Examples
# \donttest{
data(avonet300, tree300)
tree <- ape::keep.tip(tree300, tree300$tip.label[seq_len(30L)])
traits <- avonet300[match(tree$tip.label, avonet300$Species_Key),
c("Mass", "Wing.Length"), drop = FALSE]
rownames(traits) <- tree$tip.label
traits$Mass[seq_len(3L)] <- NA_real_
pred <- impute(traits, tree, epochs = 5L, verbose = FALSE)$prediction
#> Error: Lantern is not loaded. Please use `install_torch()` to install additional dependencies.
plot(pred)
#> Error: object 'pred' not found
plot(pred, type = "scatter", data = traits)
#> Error: object 'pred' not found
plot(pred, type = "intervals", trait = "Mass")
#> Error: object 'pred' not found
# }
