I am using ctree()
in package party
/partykit
to plot a survival tree of a survival model.
Overall survival is good, 95% survival at worst, so I would like to change the yscale
to c(0.9, 1)
so that the panels are useful on the final plot.
I need to adjust the yscale
arguments in the terminal panels of the survival plots but this throws up an error and does not seem to be possible.
Is this possible in ctree()
or should I use another method?
I have added arguments for yscale
to the terminal_panel
function but this thorws up an error
"Error in survfitKM(X, newY, casewt, ...) :
unused argument (yscale = c(0.9, 1))"
plot(taperfit.ct, terminal_panel = node_surv(taperfit.ct, yscale = c(0.9, 1)))
I expected this to change the scale to zoom in on the KM plots with y axis scale form 90% survival to 100% survival, but this did not happen.
So far the node_surv()
function did not have a yscale
argument and hence when you provided it, it got passed on to the wrong function yielding an error. However, I just added it to the partykit
repository on R-Forge. Thus, if you check out and build partykit
from there your code
plot(taperfit.ct, terminal_panel = node_surv(taperfit.ct, yscale = c(0.9, 1)))
or for short
plot(taperfit.ct, tp_args = list(yscale = c(0.9, 1)))
should work.
You can also manually work around the issue if you're using the old party
implementation (or have troubles with building partykit
).
taperplot <- node_surv(taperfit.ct, yscale = c(0.9, 1))
fix(taperplot) ## go to line 11 and change the definition of yscale
plot(taperfit.ct, terminal_panel = taperplot)