Skip to content

Commit

Permalink
using panel spacing from the global theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Dec 14, 2024
1 parent 00812c5 commit 0c2d833
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 28 deletions.
9 changes: 6 additions & 3 deletions R/alignpatch-align_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,12 @@ update_layout_title <- function(old, new) update_non_waive(old, new)
#'
#' - modify the theme of the layout
#'
#' @param theme A [`theme()`][ggplot2::theme] used to render the `guides`,
#' `title`, `subtitle`, `caption`, `margins`, `patch.title`, `panel.border`, and
#' `background`. If `NULL` (default), will inherit from the parent `layout`.
#' @param theme A [`theme()`][ggplot2::theme] object used to customize various
#' elements of the plot, including `guides`, `title`, `subtitle`, `caption`,
#' `margins`, `patch.title`, `panel.border`, and `background`. By default, the
#' theme will inherit from the parent `layout`. When aligning observations, it
#' also controls the panel spacing for all plots in the layout.
#'
#' @inheritParams rlang::args_dots_empty
#'
#' @details
Expand Down
2 changes: 1 addition & 1 deletion R/layout-.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ inherit_parent_layout_theme <- function(layout, theme, direction) {
panel.spacing.x = calc_element("panel.spacing.x", theme)
)
}
if (is.null(layout@theme)) return(layout@theme) # styler: off
if (is.null(layout@theme)) return(theme) # styler: off
layout@theme + theme
}

Expand Down
6 changes: 6 additions & 0 deletions R/layout-quad-build.R
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ quad_build.QuadLayout <- function(quad, schemes = NULL, theme = NULL,

# add action ----------------------------------------
p <- plot_add_schemes(p, inherit_schemes(quad@body_schemes, schemes))
if (!is.null(row_coords)) {
p <- p + theme(panel.spacing.y = calc_element("panel.spacing.y", theme))
}
if (!is.null(column_coords)) {
p <- p + theme(panel.spacing.x = calc_element("panel.spacing.x", theme))
}

# collect all plots and sizes ----------------------
plots <- append(plots, list(main = p), 2L)
Expand Down
8 changes: 5 additions & 3 deletions man/align_plots.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/cross_align.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/ggoncoplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/heatmap_layout.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/layout_annotation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/quad_free.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/quad_layout.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/stack_align.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0c2d833

Please sign in to comment.