h_grob_y_annot | R Documentation |
Build the y-axis annotation from a decomposed ggplot
.
h_grob_y_annot(ylab, yaxis)
ylab |
( |
yaxis |
( |
A gTree
object containing the y-axis annotation from a ggplot
.
library(dplyr)
library(survival)
library(grid)
fit_km <- tern_ex_adtte %>%
filter(PARAMCD == "OS") %>%
survfit(formula = Surv(AVAL, 1 - CNSR) ~ ARMCD, data = .)
data_plot <- h_data_plot(fit_km = fit_km)
xticks <- h_xticks(data = data_plot)
gg <- h_ggkm(
data = data_plot,
censor_show = TRUE,
xticks = xticks, xlab = "Days", ylab = "Survival Probability",
title = "title", footnotes = "footnotes", yval = "Survival"
)
g_el <- h_decompose_gg(gg)
grid::grid.newpage()
pvp <- grid::plotViewport(margins = c(5, 4, 2, 20))
pushViewport(pvp)
grid::grid.draw(h_grob_y_annot(ylab = g_el$ylab, yaxis = g_el$yaxis))
grid.rect(gp = grid::gpar(lty = 1, col = "gray35", fill = NA))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.