Created
April 16, 2021 17:07
-
-
Save cddesja/6ef1871467e5552f816146e687677cd3 to your computer and use it in GitHub Desktop.
definition of censoring plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vadj <- .03 | |
hadj <- .015 | |
grid.newpage() | |
vp <- viewport(width=0.85,height=0.85) | |
pushViewport(vp) | |
grid.lines(x = c(0, 1), | |
y = c(0, 0), | |
gp = gpar(fill = "black"), | |
arrow = arrow(angle = 20, type = "closed")) | |
## participants | |
grid.lines(x = c(0, .7), | |
y = c(.2, .2)) | |
grid.lines(x = c(0, .4), | |
y = c(.4, .4)) | |
grid.lines(x = c(0, .9), | |
y = c(.6, .6)) | |
grid.lines(x = c(0, .5), | |
y = c(.8, .8), | |
gp = gpar(col = "red")) | |
grid.lines(x = c(.9, .9), | |
y = c(-.01, .01)) | |
## y-axis | |
grid.lines(x = c(0, 0), | |
y = c(0, 1)) | |
# Add labels | |
grid.text("Study Closure", x = .9, y = -.03) | |
grid.text(0, x = 0, y = -.03) | |
grid.text("Follow-up Time from Randomization", x = .5, y = -.07) | |
grid.text(4, x = -0.02, y = .2) | |
grid.text(3, x = -0.02, y = .4) | |
grid.text(2, x = -0.02, y = .6) | |
grid.text(1, x = -0.02, y = .8, gp = gpar(col = "red")) | |
grid.text("Participant ID", x = -.06, y = .5, rot = 90) | |
grid.text("X", x = .5 + hadj, y = .8, gp = gpar(col = "red")) | |
grid.text("CVD Death", x = .5 + hadj, y = .8 - vadj, gp = gpar(col = "red")) | |
grid.text("O", x = .9 + hadj, y = .6) | |
grid.text("O", x = .4 + hadj, y = .4) | |
grid.text("Lost to Follow-up", x = .4 + hadj, y = .4 - vadj) | |
grid.text("O", x = .7 + hadj, y = .2) | |
grid.text("Cancer Death", x = .7 + hadj, y = .2 - vadj) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment