保持原始图片比例为{ggimage}

时间:2019-12-16 19:59:34

标签: r ggimage

我正在尝试在{ggimage}层中使用非正方形图像,但是我似乎无法使该比率适合原始图像比率。文档指向asp参数,但这似乎不起作用。

这显然是非正方形的图像:https://ps.w.org/insert-headers-and-footers/assets/banner-772x250.png

这是{ggimage}的结果:

library(ggimage)
library(ggplot2)
d <- data.frame(
  x = 1,
  y = 1,
  image = "https://ps.w.org/insert-headers-and-footers/assets/banner-772x250.png"
)
ggplot(d, aes(x, y)) + 
  geom_image(aes(image=image), size = 1)

ggplot(d, aes(x, y)) + 
  geom_image(aes(image=image), size = 1, asp = 0.1)

ggplot(d, aes(x, y)) + 
  geom_image(aes(image=image), size = 1, asp = 0.5)

ggplot(d, aes(x, y)) + 
  geom_image(aes(image=image), size = 1, asp = 0.9)

enter image description here

enter image description here

enter image description here

enter image description here

如何使图像保持原始的宽高比?

0 个答案:

没有答案