-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to incorporate externally generated figures? #283
Comments
You can draw pictures to a ggplot with e.g. library(ggplot2)
library(patchwork)
p = ggplot(data = mtcars, aes(x = hp, y = disp)) +
geom_point()
img = ggplot() +
cowplot::draw_image("https://cran.r-project.org/Rlogo.svg")
p + img |
Thanks, that makes sense. Thanks for sharing an example! |
Hi @mhovd , thanks for the solution. Do you know if there is a way to reduce or eliminate the gray padding around the |
You can add a raster image directly with patchwork, treating it as any other plot object library(ggplot2)
library(patchwork)
p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
logo <- system.file('help', 'figures', 'logo.png', package = 'patchwork')
logo <- png::readPNG(logo, native = TRUE)
p1 + logo Created on 2023-08-08 by the reprex package (v2.0.1) |
For future travelers like myself, note that |
This is already documented in the vignettes |
Hi,
Is there a way to incorporate externally generated figures while composing layouts with this package?
Thanks,
Minita
The text was updated successfully, but these errors were encountered: