Skip to content

Commit

Permalink
fix: onepager scaling issue
Browse files Browse the repository at this point in the history
- scale onepager height based on nr of channel
- fix one typo
  • Loading branch information
gufengzhou committed Jul 19, 2023
1 parent 7239391 commit 18a9257
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/R/clusters.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions R/R/plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18a9257

Please sign in to comment.