parttree
parttree copied to clipboard
Add dedicated plot.parttree method
Closes #14. Closes #16. Addresses #9 (even if it doesn't provide a formal fix).
This PR introduces a formal "parttree" class and provides a native plot.parttree method using base R graphics (powered by tinyplot). The ggplot2 scaffolding is still supported via geom_parttree().
Example from the new README:
library(rpart)
library(parttree)
fit = rpart(Kyphosis ~ Start + Age, data = kyphosis)
fit_pt = parttree(fit)
# Default plot
plot(fit_pt)

# Cusomized plot
plot(
fit_pt,
border = NA, # no partition borders
pch = 19, # filled points
alpha = 0.6, # point transparency
grid = TRUE, # background grid
palette = "classic", # new colour palette
xlab = "Topmost vertebra operated on", # custom x title
ylab = "Patient age (months)", # custom y title
main = "Tree predictions: Kyphosis recurrence" # custom title
)

Created on 2024-07-25 with reprex v2.1.0
It includes several smaller changes at the same time, e.g. flipaxes is renamed to flip.