if (FALSE) {
library("ggplot2")
library("ggimage")
set.seed(2017-02-21)
d <- data.frame(x = rnorm(10),
y = rnorm(10),
image = sample(c("https://www.r-project.org/logo/Rlogo.png",
"https://jeroenooms.github.io/images/frink.png"),
size=10, replace = TRUE)
)
# With caching enabled (default)
ggplot(d, aes(x, y)) + geom_image(aes(image=image))
# With caching disabled
ggplot(d, aes(x, y)) + geom_image(aes(image=image), use_cache=FALSE)
# Per-row image size, via the `width` and `height` aesthetics
ggplot(d, aes(x, y)) +
geom_image(aes(image=image, width=abs(x)/10, height=abs(y)/10))
# Only one of them: the other dimension keeps the ratio of the image
ggplot(d, aes(x, y)) + geom_image(aes(image=image, width=abs(x)/10))
}
Run the code above in your browser using DataLab