Skip to content

Commit

Permalink
always remove margins for stack_layout in the flank area
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Jan 10, 2025
1 parent 2b4dce4 commit 0d49ea0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/layout-stack-composer.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ stack_composer_add <- function(plot, composer, ...) {
UseMethod("stack_composer_add")
}

#' @importFrom utils packageVersion
#' @export
stack_composer_add.ggalign_plot <- function(plot, composer, design, ...,
schemes, theme,
Expand Down Expand Up @@ -118,6 +119,13 @@ stack_composer_add.ggalign_plot <- function(plot, composer, design, ...,
# let `align` add other components
plot <- align$build_plot(plot, design = design, ...)
plot <- align$finish_plot(plot, plot_schemes, theme)
if (packageVersion("ggplot2") > "3.5.1") {
plot <- plot + switch_direction(
direction,
theme(plot.margin = margin(t = 0, r = NA, b = 0, l = NA)),
theme(plot.margin = margin(t = NA, r = 0, b = NA, l = 0))
)
}
stack_composer_align_plot(composer, plot, size)
}

Expand Down

0 comments on commit 0d49ea0

Please sign in to comment.