Skip to content

Commit

Permalink
fix issue with scores plot by multiplying height, width with nrow, nc…
Browse files Browse the repository at this point in the history
…ol, scales = 'free'
  • Loading branch information
lgessl committed Jan 19, 2024
1 parent b7ea2a2 commit 5fcb360
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions R/assess_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ assess_model <- function(
predicted = prep[["predicted"]],
actual = prep[["actual"]],
perf_plot_spec = pps_scores,
ncol = model_spec$plot_ncols,
msg_prefix = msg_prefix
)
}
Expand Down
8 changes: 7 additions & 1 deletion R/assess_model_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ plot_risk_scores <- function(
)
tbl[["split"]] <- paste0("Split ", tbl[["split"]])

n_split <- sum(!sapply(predicted, is.null))
nrow <- ceiling(n_split/ncol)
perf_plot_spec$height <- nrow * perf_plot_spec$height
perf_plot_spec$width <- ncol * perf_plot_spec$width

plt <- ggplot2::ggplot(
tbl,
ggplot2::aes(
Expand All @@ -219,7 +224,8 @@ plot_risk_scores <- function(
) +
ggplot2::facet_wrap(
facets = ggplot2::vars(.data[["split"]]),
ncol = ncol
ncol = ncol,
scales = "free"
) +
ggplot2::geom_point() +
ggplot2::labs(
Expand Down

0 comments on commit 5fcb360

Please sign in to comment.