Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205423

Change legend labels in ggcompetingrisks plot in r

$
0
0

I have made a cumulative incidence plot using cmprsk::cuminc and then ggcompetingrisks for plotting. I want to change legend labels for the group. I've tried with legend.lab = c("A", "B", "C"). This works when I do a ggsurvplot without competing risk. But it does not work now. Any suggestions?

My code is like:

    fit <- cuminc(df$Time, df$Event, group = df$genotype)

p <- ggcompetingrisks(fit, multiple_panels = FALSE, palette = "black",
                 legend.title = c("genotype"),
                legend.labs = c("A", "B", "C"))

The thing is that the legend show both the Event (0, 1) and the Group (1, 2, 3). I want only the group to be shown in the legend and I want it to be named A, B and C..

Please help me!!


Viewing all articles
Browse latest Browse all 205423

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>