Search code examples
rcolorsparty

How to change colour of the survival curves in a survival ctree object r


I am doing a survival ctree with party package (R software) and i would like to have coloured survival curves in the terminal panel.

fitform <- Surv(delai_efs ,evt_efs) ~ age + sexer + ... + bmiins + tailler + 

tree = ctree(formula = fitform, data = taclfknn, controls = ctree_control(teststat = "max", testtype = "Teststatistic")

plot(tree)

I tried to change the source code integrating additional arguments like color or using gp = gpar(col=...) but i failed...

enter image description here

Any help ?

Thanks


Solution

  • Here is the solution for function ctree from partykit package.

    You can specify plotting parameters for different types of terminal nodes. All parameter for your case can be found ?node_surv

    To change a colour of survival curve:

    plot(tree, terminal_panel=node_surv(tree, col="green"))