ggplot2:完整的地块尺寸图像

时间:2018-05-26 19:35:56

标签: r ggplot2 ggimage

我想知道如何获得带有完整地块尺寸图像的ggplot2图表

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

1 个答案:

答案 0 :(得分:1)

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