-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated scipts to create worse versions of the figures with no riskta…
…bles. Simplicity.
- Loading branch information
1 parent
ea0aac0
commit 0afe87f
Showing
4 changed files
with
171 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
plot_one_survfit_no_risktable <- function( | ||
dat, | ||
surv_form, | ||
pal = c('#bb5566', '#004488', '#ddaa33'), | ||
plot_title = NULL, | ||
plot_subtitle = NULL, | ||
x_title = "Years", | ||
x_exp = 0.15, | ||
x_breaks = seq(0, 100, by = 2.5), | ||
force_color = NULL | ||
) { | ||
|
||
gg <- survfit2(surv_form, data = dat) | ||
|
||
# couldn't figure out how to do this without an if/else, sadly. | ||
if (!is.null(force_color)) { | ||
gg %<>% ggsurvfit(color = force_color) | ||
} else { | ||
gg %<>% ggsurvfit() | ||
} | ||
|
||
gg <- gg + | ||
scale_y_continuous( | ||
expand = c(0,0), | ||
label = scales::label_percent(), | ||
name = "Survival" | ||
) + | ||
scale_x_continuous( | ||
name = x_title, | ||
expand = expansion(add = 0, mult = c(0, x_exp)), # needed to prevent clipping | ||
breaks = x_breaks | ||
) + | ||
scale_color_manual( | ||
values = pal | ||
) + | ||
coord_cartesian( | ||
xlim = c(0, NA), | ||
ylim = c(0,1.01), | ||
expand = T | ||
) + | ||
labs( | ||
title = plot_title, | ||
subtitle = plot_subtitle | ||
) + | ||
theme( | ||
axis.title.y = element_blank(), | ||
plot.title.position = "plot", | ||
title = element_markdown(), | ||
# prevents the axis tick label clipping: | ||
plot.margin=unit(c(.2,.2,.2,.2),"cm") | ||
) | ||
|
||
return(gg) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Creates an output versions of figures for GU ASCO 2025 submission poster. | ||
|
||
library(purrr); library(fs); library(here); | ||
purrr::walk(.x = fs::dir_ls(here('R')), .f = source) | ||
|
||
dir_out <- here('output', 'fig', 'manu') | ||
|
||
os_by_stage <- readr::read_rds( | ||
file = here('data', 'survival', 'os_dx_by_stage_manu.rds') | ||
) | ||
|
||
first_line_platinum <- readr::read_rds( | ||
file = here('data', 'survival', 'first_line_platinum', 'gg_first_line_platinum.rds') | ||
) | ||
|
||
first_line_by_ddr <- readr::read_rds( | ||
file = here('data', 'survival', 'ddr_onco', | ||
'gg_met_ddr_manu.rds') | ||
) | ||
|
||
first_line_by_ddr_plat <- readr::read_rds( | ||
file = here('data', 'survival', 'ddr_onco', | ||
'gg_met_ddr_plat_split.rds') | ||
) | ||
|
||
second_line_by_ddr_io <- readr::read_rds( | ||
file = here('data', 'survival', 'ddr_onco', | ||
'gg_os_2l_io_ddr.rds') | ||
) | ||
|
||
|
||
|
||
fig1_comb <- plot_grid( | ||
ggsurvfit_build(os_by_stage), | ||
ggsurvfit_build(first_line_platinum), | ||
ggsurvfit_build(first_line_by_ddr), | ||
ggsurvfit_build(first_line_by_ddr_plat), | ||
ggsurvfit_build(second_line_by_ddr_io), | ||
labels = "AUTO", | ||
align = 'hv', | ||
axis = 't', | ||
ncol = 2 | ||
) | ||
|
||
|
||
|
||
ggsave( | ||
plot = fig1_comb, | ||
filename = here(dir_out, 'fig1.pdf'), | ||
height = 7.5, width = 7, scale = 1.8 | ||
) | ||
|
||
ggsave( | ||
plot = fig1_comb, | ||
filename = here(dir_out, 'fig1.png'), | ||
height = 7.5, width = 7, scale = 1.8 | ||
) |
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
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