Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull Request by Zilin Huang regarding Issue #216 #226

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion R/scale_ggsurvfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,20 @@
#' # specify additional scales
#' ggsurvfit +
#' scale_ggsurvfit(x_scales = list(breaks = seq(0, 8, by = 2)))
#'
#' # Specical case: in the risk table, large numbers (with more than 4 digits) may not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of putting this text as a comment in the examples section, let's add it to a new section the help file using the #' @details tag.

#' # be shown completely, with some digits truncated outside the plot region.
#' # To remedy this, consider the following example code for a simulated large-size survival dataset:
#' # Here, adjust the size in `add_risktable(size = 2.5)` (as an example) can decrease the font size of the risk table
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason people see this issue is because the default padding when using scale_ggsurvit() is too restrictive, so the best "fix" is going to live here in this function rather than reducing the font size of the risk table.

The proposed fix is going to be a change to the expand scale argument in this function.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ddsjoberg a lot for your suggestion, I've already addressed this issue and inside the new commit.

#' # and make the numbers all fit in the plot region. The scale of the `size` argument differs by cases.
#' df_colon_large <- df_colon[sample(1:nrow(df_colon), size = 15*nrow(df_colon), replace = TRUE), ]
#' ggsurvfit <-
#' survfit2(Surv(time, status) ~ surg, data = df_colon_large) %>%
#' ggsurvfit() + add_risktable(size = 2.5) +
#' scale_ggsurvfit()
#' @inherit ggsurvfit seealso
scale_ggsurvfit <- function(x_scales = list(), y_scales = list()){
scale_ggsurvfit <-
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this back on one line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already done this. It'll be ready to merge.

function(x_scales = list(), y_scales = list()){
scale_ggsurvfit_empty_list <- list()
structure(scale_ggsurvfit_empty_list, x_scales = x_scales, y_scales = y_scales, class = "scale_ggsurvfit")
}
Expand Down
Loading