Skip to content

Commit

Permalink
fix various check issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Jan 5, 2024
1 parent ccfcc97 commit 842ba80
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ importFrom(ggplot2,is.ggplot)
importFrom(ggplot2,is.theme)
importFrom(ggplot2,labs)
importFrom(ggplot2,margin)
importFrom(ggplot2,max_height)
importFrom(ggplot2,max_width)
importFrom(ggplot2,panel_cols)
importFrom(ggplot2,panel_rows)
importFrom(ggplot2,scale_x_continuous)
Expand Down Expand Up @@ -140,6 +142,7 @@ importFrom(gtable,gtable_add_rows)
importFrom(gtable,gtable_height)
importFrom(gtable,gtable_width)
importFrom(gtable,is.gtable)
importFrom(stats,ave)
importFrom(stats,na.omit)
importFrom(utils,as.roman)
importFrom(utils,modifyList)
Expand Down
3 changes: 3 additions & 0 deletions R/collect_axes.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ collect_axes <- function(gt, dir = "x") {
# For every given row, check if all non-zero grobs occupying that row have a
# name that has a pattern. If all these grobs in that row do, measure the
# grob heights and put that into the gtable's heights.
#' @importFrom ggplot2 max_height
retrofit_rows <- function(gt, rows, pattern = NULL) {
if (is.null(pattern) || length(rows) == 0) {
return(gt)
Expand Down Expand Up @@ -166,6 +167,7 @@ retrofit_rows <- function(gt, rows, pattern = NULL) {
# For every given column, check if all non-zero grobs occupying that column
# have a name that has a pattern. If all these grobs in that column do, measure
# the grob widths and put that into the gtable's widths.
#' @importFrom ggplot2 max_width
retrofit_cols <- function(gt, cols, pattern = NULL) {
if (is.null(pattern) || length(cols) == 0) {
return(gt)
Expand Down Expand Up @@ -240,6 +242,7 @@ is_zero <- function(x) {
}

# Determine uniqueness of grobs
#' @importFrom stats ave
grob_id <- function(grobs, layout, byrow, merge = FALSE) {

# Hash the grobs to determine unique grobs
Expand Down
8 changes: 5 additions & 3 deletions R/inset_element.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
#' # Grobs and other objects can be added as insets as well
#' p1 + inset_element(grid::circleGrob(), 0.4, 0.4, 0.6, 0.6)
#'
#' logo <- system.file('help', 'figures', 'logo.png', package = 'patchwork')
#' logo <- png::readPNG(logo, native = TRUE)
#' p1 + inset_element(logo, 0.8, 0.8, 1, 1, align_to = 'full')
#' if (requireNamespace('png', quietly = TRUE)) {
#' logo <- system.file('help', 'figures', 'logo.png', package = 'patchwork')
#' logo <- png::readPNG(logo, native = TRUE)
#' p1 + inset_element(logo, 0.8, 0.8, 1, 1, align_to = 'full')
#' }
#'
#' # Just as expected insets are still amenable to changes after the fact
#' p1 +
Expand Down
8 changes: 5 additions & 3 deletions man/inset_element.Rd

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

2 changes: 1 addition & 1 deletion man/plot_layout.Rd

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

0 comments on commit 842ba80

Please sign in to comment.