I want to create a decision tree plot which display an overlay histogram in each node as shown in the picture:
The following code creates the left side picture:
library(earth)
library(rpart)
library(rpart.plot)
a <- rpart(O3~., data=ozone1, cp=.2)
prp(a, type=4, fallen=T, branch=.3, round=0, leaf.round=9,
clip.right.labs=F, under.cex=1,
box.palette="GnYlRd",
prefix="ozone\n", branch.col="gray", branch.lwd=2,
extra=101, under=T, lt=" < ", ge=" >= ", cex.main=1.5)
I think the node.fun from the rpart.plot can do the job, but I don't know how to implement it.