Calculate the positions of ticks on the x-axis. However, if xticks
already
exists it is kept as is. It is based on the same function ggplot2
relies on,
and is required in the graphic and the patient-at-risk annotation table.
Arguments
- data
(
data.frame
)
survival data as pre-processed byh_data_plot
.- xticks
(
numeric
,number
, orNULL
)
numeric vector of ticks or single number with spacing between ticks on the x axis. IfNULL
(default),labeling::extended()
is used to determine an optimal tick position on the x axis.- max_time
(
numeric
)
maximum value to show on X axis. Only data values less than or up to this threshold value will be plotted (defaults toNULL
).
Examples
if (FALSE) {
library(dplyr)
library(survival)
data <- tern_ex_adtte %>%
filter(PARAMCD == "OS") %>%
survfit(form = Surv(AVAL, 1 - CNSR) ~ ARMCD, data = .) %>%
h_data_plot()
h_xticks(data)
h_xticks(data, xticks = seq(0, 3000, 500))
h_xticks(data, xticks = 500)
h_xticks(data, xticks = 500, max_time = 6000)
h_xticks(data, xticks = c(0, 500), max_time = 300)
h_xticks(data, xticks = 500, max_time = 300)
}