0

I am working with the glmertree package in R, which is an extension of the partykit package. I am trying to plot a model using the glmertree plotting function, which simply extends the partykit plotting function. I would like to make the circles for the internal nodes smaller in my plot so that they do not all overlap. I have extensively researched the ip_args (inner panel args) option for a party kit plot, but all I have managed to do is change the font size or the font color or what is printed in the internal node- I cannot change the circle size. Can anyone help with this?

Default plot, made with the code plot(glmr_reasonable)

Using the code:

ip_args=list(abbreviate=FALSE, pval=FALSE, gp=gpar(cex=0.5, col="red", pin=c(0.25, 0.25))) 

plot(glmr_reasonable, ip_args=ip_args)

I was able to make the following changes:

New plot

However, I don't want red text and tiny font, I want smaller circles. Does anyone know how to help?

Thanks!

Achim Zeileis
  • 15,710
  • 1
  • 39
  • 49
acn
  • 1
  • Welcome to StackOverflow! Please read the info about **[How to ask a good question](https://stackoverflow.com/help/how-to-ask)** and **[how to make a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)**. This will make it much easier for others to help you. In the question above, giving a limited data set would give something to play with for those who want to help you. – KoenV Mar 26 '18 at 08:15

1 Answers1

0

The node_inner() panel function currently determines how large the label for the longest splitting variable name is and chooses the size of the ellipse correspondingly. However, due to a bug (that I just fixed on R-Forge) the gpar settings within the ip_args had not been processed correctly.

If you have one (or a few) variable name(s) that is/are quite long like STABLE_RESIDENCE then all ellipses become larger. (It would just look awkward to make this only larger for some nodes.) To save space you can either abbreviate the text or decrease the font size:

  1. By setting ip_args = list(abbreviate = 10), say, only those variable names that are longer than 10 would get abbreviated automatically, thus making all ellipses smaller.

  2. By decreasing the fontsize throughout the entire plot you will also make the ellipses smaller, e.g., plot(..., gp = gpar(fontsize = 9)).

  3. Decreasing the fontsize just locally in the inner nodes (but not the rest of the tree) will also make the ellipses smaller, e.g., ip_args = list(gp = gpar(fontsize = 9)).

The last point did not work correctly up to now but I have just committed a fix to R-Forge. (To install this you currently have to check out and install by hand because R-Forge's auto-builder currently seems to hang...)

Achim Zeileis
  • 15,710
  • 1
  • 39
  • 49