Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dedicated plot.parttree method #18

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Add dedicated plot.parttree method #18

wants to merge 25 commits into from

Conversation

grantmcdermott
Copy link
Owner

@grantmcdermott grantmcdermott commented Jul 25, 2024

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.

@grantmcdermott
Copy link
Owner Author

Hmmm. Workflows are failing due missing ggplot2 installation. But the log file shows that it has been installed. https://github.com/grantmcdermott/parttree/actions/runs/10102909981/job/27939351692?pr=18#step:5:4882

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plot.parttree method Add viz tests
1 participant