library(ggplot2)
# Create example data
data <- data.frame(x = c(2, 4), y = c(2, 4),
image_path = "https://www.r-project.org/logo/Rlogo.png",
height = c(1,2), width = c(3,0.5))
q <- ggplot(data) + lims(x = c(0, 6), y = c(0, 6))
# Without size specifications
q + geom_chronochRtImage(aes(image_path = image_path, x = x, y = y))
# Scale images to individual heights/widths by specifying one of them:
q + geom_chronochRtImage(aes(image_path = image_path, x = x, y = y,
height = height))
# Scale images to uniform height/width (i.e. independent of input data):
q + geom_chronochRtImage(aes(image_path = image_path, x = x, y = y,
height = 1))
# Specifying height and width might result in distorted images:
q + geom_chronochRtImage(aes(image_path = image_path, x = x, y = y,
height = height, width = width))
Run the code above in your browser using DataLab