From 18a9257128d75a578442f024b1895ce69c49200c Mon Sep 17 00:00:00 2001 From: gufengzhou Date: Wed, 19 Jul 2023 12:20:51 +0800 Subject: [PATCH] fix: onepager scaling issue - scale onepager height based on nr of channel - fix one typo --- R/R/clusters.R | 2 +- R/R/plots.R | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/R/R/clusters.R b/R/R/clusters.R index ac46096b8..8c7ac140c 100644 --- a/R/R/clusters.R +++ b/R/R/clusters.R @@ -123,7 +123,7 @@ robyn_clusters <- function(input, dep_var_type, all_media = NULL, k = "auto", li sim_n = ci_list$sim_n, errors_weights = weights, # Within Groups Sum of Squares Plot - wss = cls$nclusters_plot + theme_lares(blackground = "white"), + wss = cls$nclusters_plot + theme_lares(background = "white"), # Grouped correlations per cluster corrs = cls$correlations + labs(title = "Top Correlations by Cluster", subtitle = NULL), # Mean ROI per cluster diff --git a/R/R/plots.R b/R/R/plots.R index 95b798fb9..8c4d64159 100644 --- a/R/R/plots.R +++ b/R/R/plots.R @@ -584,10 +584,13 @@ robyn_onepagers <- function(InputCollect, OutputCollect, select_model = NULL, qu rver <- utils::sessionInfo()$R.version onepagerTitle <- sprintf("One-pager for Model ID: %s", sid) onepagerCaption <- sprintf("Robyn v%s [R-%s.%s]", ver, rver$major, rver$minor) - pg <- wrap_plots(p2, p5, p1, p8, p3, p7, p4, p6, ncol = 2) + + get_height <- length(unique(dt_geometric$channels)) / 5 + pg <- (p2 + p5) / (p1 + p8) / (p3 + p7) / (p4 + p6) + + patchwork::plot_layout(heights = c(get_height, get_height, get_height, 1), guides = "collect") + + #pg <- wrap_plots(p2, p5, p1, p8, p3, p7, p4, p6, ncol = 2) + plot_annotation( title = onepagerTitle, subtitle = errors, - theme = theme_lares(background = "white", ), + theme = theme_lares(background = "white", legend = "none"), caption = onepagerCaption ) all_plots[[sid]] <- pg