Description Usage Arguments Author(s) Examples
Make an image as ggplot2 background or change a bitmap to a ggplot2 object
1 |
image |
raster object to display |
Zhonghui Gai
1 2 3 4 5 6 7 8 9 10 11 12 13 | image <- jpeg::readJPEG(source = "Einstein.JPG")
p <- ggplot() + geom_image(image = image)
p <- p + ggpatch:::theme_nothing()
library(patchwork)
p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p + patchwork::inset_element(p1, 0.6, 0.6, 1, 1)
p1 + inset_element(p, 0.6, 0.6, 1, 1)
p + p1
image2 <- jpeg::readJPEG(source = "GoldenGirls.JPG")
p2 <- ggplot() + geom_image(image = image2) + ggpatch:::theme_nothing()
p + p1/p2 + patch_annotation()
# use image as background
ggplot(mtcars) + geom_image(image = image) +geom_point(aes(mpg, disp), color = "red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.