Skip to content

Commit

Permalink
Fix bug in plot_bivariate()
Browse files Browse the repository at this point in the history
  • Loading branch information
cjvanlissa committed Nov 26, 2024
1 parent 5dbef96 commit d7e12d9
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions R/plot-bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,6 @@ merge_corplots <- function(plots, ...) {
plot2_grobs$grobs[[which(sapply(plot2_grobs$grobs, `[[`, "name") == "guide-box")]]
width_grob <- grobWidth(plot2_grobs$grobs[[grep("^axis.title.y.left", sapply(plot2_grobs$grobs, `[[`, "name"))]])

# axes <- lapply(plots[1:n_vars], function(x){
# tmp <- ggplot_gtable(ggplot_build(x))
# tmp$grobs[[grep("^axis.title.y.left", sapply(tmp$grobs, `[[`, "name"))]]
# })

model_mat <- matrix(1L:(n_vars * n_vars), nrow = n_vars)
model_mat[upper.tri(model_mat)] <- NA
Expand Down Expand Up @@ -362,17 +358,12 @@ merge_corplots <- function(plots, ...) {
plots[[x]]$widths[4] <- plots[[x]]$widths[4]+width_grob
}
plots[[x]]$heights <- fixed_heights
if(!x %in% model_mat[nrow(model_mat), ]){
plots[[x]]$heights[c(1,9)] <- unit(0, "cm")
plots[[x]]$heights[8] <- plots[[x]]$heights[8]+width_grob
}
#Hier gaat iets mis. Ik weet niet waarom dit er oorspronkelijk stond..
# if(!x %in% model_mat[nrow(model_mat), ]){
# plots[[x]]$heights[c(1)] <- unit(0, "cm")
# plots[[x]]$heights[8] <- plots[[x]]$heights[8]+width_grob
# }
}
#plots[-c(1:n_vars)] <- lapply(plots[-c(1:n_vars)], function(x) {


#x$heights <- fixed_heights
# x
#})

plots[[((n_vars - 1) * n_vars) + 1]] <- grob_legend

Expand Down

0 comments on commit d7e12d9

Please sign in to comment.