Skip to content

Image grobs aren't treated like normal patches in some cases #221

Closed
@mattwarkentin

Description

@mattwarkentin

Hi Thomas,

Not sure if this is a bug or just a feature not yet implemented (or I'm just doing something wrong), but it seems like images cannot be treated just like ggplot objects for composing patchworks. For the two examples that fail below, they work if logo is replaced with p1, a ggplot object.

library(magrittr)
library(ggplot2)
library(patchwork)

p1 <- 
  mtcars %>% 
  ggplot(aes(mpg, hp)) +
  geom_point() + 
  theme_light()

logo <- system.file('help', 'figures', 'logo.png', package = 'patchwork')
logo <- png::readPNG(logo, native = TRUE)

(p1 / p1) / logo

(p1 / p1) | logo
#> Error: Only knows how to fold ggplot objects together

(p1 | p1) / logo
#> Error: Only knows how to fold ggplot objects together

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions