geom_image: Make an image as ggplot2 background or change a bitmap to a...

Description Usage Arguments Author(s) Examples

Description

Make an image as ggplot2 background or change a bitmap to a ggplot2 object

Usage

1

Arguments

image

raster object to display

Author(s)

Zhonghui Gai

Examples

 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")

ZhonghuiGai/ggpatch documentation built on Dec. 18, 2021, 8:28 p.m.