Generates a bar plot showing the frequency of different tree structures represented in a list of tree graphs. Optionally, it can filter to show only the top N trees and handle stump trees specially.

treeBarPlot(trees, iter = NULL, topTrees = NULL, removeStump = FALSE)

Arguments

trees

A list of tree graphs to display

iter

Optional; specifies the iteration to display.

topTrees

Optional; the number of top tree structures to display. If NULL, displays all.

removeStump

Logical; if TRUE, trees with no edges (stumps) are excluded from the display

Value

A `ggplot` object representing the bar plot of tree frequencies.

Details

This function processes a list of tree structures to compute the frequency of each unique structure, represented by a bar plot. It has options to exclude stump trees (trees with no edges) and to limit the plot to the top N most frequent structures.

Examples

if (FALSE) {
df_trees <- extractTreeData(model = my_model, data = my_data)
plot <- treeBarPlot(trees = df_trees, topTrees = 10, removeStump = TRUE)
}