Search code examples
rplottitleuniformpar

R: Main title for prp plot too far up (uniform=TRUE)


I have a (small) decision tree that I want to plot using prp. To avoid that the tree is streched very long, I use the option uniform=TRUE. However, the main title of the graph is still located at the very top of the figure: In the same spot where it would be if uniform=FALSE. The whole plotting function looks like this:

prp(dtree_85, main ="Decision Tree with 85 variables",  extra=2, col=cols, border.col=cols, fallen.leaves=TRUE, branch=1, varlen=0, faclen=0, box.col=0, shadow.col="darkgray", leaf.round=3, 
split.box.col=0, split.round=3, split.shadow.col="darkgray", split.border.col="black", branch.type=0, branch.tweak=0.5, uniform=TRUE)

Is there a nice way to solve this problem?

<code>uniform=FALSE</code> above is uniform=FALSE, below is uniform=TRUE

<code>uniform=TRUE</code>


Solution

  • You may want to shorten the device window you are drawing in.

    png(file=..., height=360, ...)
      plot(...)
    dev.off()