rggplot2ggimage

ggplot2: Full plot size image


I wonder how to get ggplot2 graph with full plot size image

library("ggplot2")
library("ggimage")
set.seed(12345)
df1 <- data.frame(x = rnorm(1),
                y = rnorm(1),
                image = "https://www.r-project.org/logo/Rlogo.png")

ggplot(df1, aes(x, y)) + 
  geom_image(aes(image=image), size=.05)

enter image description here

df2 <- data.frame()
ggplot(df2) +
  geom_point() 

enter image description here


Solution

  • library("ggimage")
    set.seed(12345)
    df1 <- data.frame(x = rnorm(1),
                      y = rnorm(1),
                      image = "https://www.r-project.org/logo/Rlogo.png")
    
    ggplot(df1, aes(x, y)) + 
        geom_image(aes(image=image), size=1)
    

    enter image description here