GuangchuangYu / ggimage

:art: Use Images in ggplot2

Home Page:https://cran.r-project.org/package=ggimage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

geom_image() changes aspect ratio arbitrarily

ashgreat opened this issue · comments

I am trying to insert a logo in my plot using geom_image(). The original logo is available here:
https://www.itvoice.in/wp-content/uploads/2016/12/zebronics_footer_logo.png
and looks like this:

When I make a ggplot using the code below, I get this image where the logo is shrunk along the x axis.

When I used reprex to make this post, the resulting logo was shrunk along Y axis. Neither of them is the correct rendition. I can't figure out what's going on here. I tried to play around with various parameters such as size and asp but I can't reproduce the original logo correctly.

library(ggplot2)
library(ggimage)

df <- data.frame(imglink = "https://www.itvoice.in/wp-content/uploads/2016/12/zebronics_footer_logo.png",
                 x = 1,
                 y = 1)

ggplot(df, aes(x = x, y = y, image = imglink)) +
  geom_image(size = 0.5) +
  theme_bw()

Created on 2020-03-07 by the reprex package (v0.3.0)

This issue got resolved after I installed development versions of ggimage and ggplot2 and restarted RStudio.