1515# ' @family PPCs
1616# '
1717# ' @template args-y-yrep
18- # ' @param size ,alpha Passed to the appropriate geom to control the appearance of
18+ # ' @param linewidth ,alpha Passed to the appropriate geom to control the appearance of
1919# ' the `yrep` distributions.
20+ # ' @param size `r lifecycle::badge("deprecated")` Please use `linewidth` instead of `size`.
2021# ' @param ... Currently only used internally.
2122# '
2223# ' @template return-ggplot
9697# ' posterior predictive draws may not be shown by default because of the
9798# ' controlled extrapolation. To display all posterior predictive draws, set
9899# ' `extrapolation_factor = Inf`.
99- # '
100+ # ' @importFrom lifecycle deprecated
100101ppc_km_overlay <- function (
101102 y ,
102103 yrep ,
103104 ... ,
104105 status_y ,
105106 left_truncation_y = NULL ,
106107 extrapolation_factor = 1.2 ,
107- size = 0.25 ,
108+ linewidth = 0.25 ,
109+ size = deprecated(),
108110 alpha = 0.7
109111) {
112+ if (lifecycle :: is_present(size )) {
113+ lifecycle :: deprecate_warn(
114+ " 1.16.0" ,
115+ " ppc_km_overlay(size)" ,
116+ details = " Please use `linewidth` instead of `size`."
117+ )
118+ linewidth <- size
119+ }
120+
110121 check_ignored_arguments(... , ok_args = " add_group" )
111122 add_group <- list (... )$ add_group
112123
@@ -173,7 +184,7 @@ ppc_km_overlay <- function(
173184 }
174185
175186 fsf $ is_y_color <- as.factor(sub(" \\ [rep\\ ] \\ (.*$" , " rep" , sub(" ^italic\\ (y\\ )" , " y" , fsf $ strata )))
176- fsf $ is_y_size <- ifelse(fsf $ is_y_color == " yrep" , size , 1 )
187+ fsf $ is_y_linewidth <- ifelse(fsf $ is_y_color == " yrep" , linewidth , 1 )
177188 fsf $ is_y_alpha <- ifelse(fsf $ is_y_color == " yrep" , alpha , 1 )
178189
179190 max_time_y <- max(y , na.rm = TRUE )
@@ -189,7 +200,7 @@ ppc_km_overlay <- function(
189200 y = .data $ surv ,
190201 color = .data $ is_y_color ,
191202 group = .data $ strata ,
192- size = .data $ is_y_size ,
203+ linewidth = .data $ is_y_linewidth ,
193204 alpha = .data $ is_y_alpha )) +
194205 geom_step() +
195206 hline_at(
@@ -204,7 +215,7 @@ ppc_km_overlay <- function(
204215 linetype = 2 ,
205216 color = get_color(" dh" )
206217 ) +
207- scale_size_identity () +
218+ scale_linewidth_identity () +
208219 scale_alpha_identity() +
209220 scale_color_ppc() +
210221 scale_y_continuous(breaks = c(0 , 0.5 , 1 )) +
@@ -218,6 +229,7 @@ ppc_km_overlay <- function(
218229# ' @export
219230# ' @rdname PPC-censoring
220231# ' @template args-group
232+ # ' @importFrom lifecycle deprecated
221233ppc_km_overlay_grouped <- function (
222234 y ,
223235 yrep ,
@@ -226,9 +238,18 @@ ppc_km_overlay_grouped <- function(
226238 status_y ,
227239 left_truncation_y = NULL ,
228240 extrapolation_factor = 1.2 ,
229- size = 0.25 ,
241+ linewidth = 0.25 ,
242+ size = deprecated(),
230243 alpha = 0.7
231244) {
245+ if (lifecycle :: is_present(size )) {
246+ lifecycle :: deprecate_warn(
247+ " 1.16.0" ,
248+ " ppc_km_overlay_grouped(size)" ,
249+ details = " Please use `linewidth` instead of `size`."
250+ )
251+ linewidth <- size
252+ }
232253 check_ignored_arguments(... )
233254
234255 p_overlay <- ppc_km_overlay(
@@ -238,7 +259,7 @@ ppc_km_overlay_grouped <- function(
238259 ... ,
239260 status_y = status_y ,
240261 left_truncation_y = left_truncation_y ,
241- size = size ,
262+ linewidth = linewidth ,
242263 alpha = alpha ,
243264 extrapolation_factor = extrapolation_factor
244265 )
0 commit comments