title: Is it possible to plot images in a ggplot2 plot, that don't get distorted when you save to any non-standard aspect ratio?
body: <p>I'm looking for any solution to this problem, regardless of packages used.</p>
  
  <p>The problem at hand is that plotted images get distorted when you save them using <code>ggsave</code>. Let me give an example:</p>
  
  <pre><code>image_links = data.frame(id = c(1,2,3,4,5),
                           image = c("https://cdn.shopify.com/s/files/1/1061/1924/products/Smiling_Emoji_with_Eyes_Opened_large.png",
                                     "https://cdn.shopify.com/s/files/1/1061/1924/products/Smiling_Emoji_with_Smiling_Eyes_large.png",
                                     "https://cdn.shopify.com/s/files/1/1061/1924/products/Hushed_Face_Emoji_large.png",
                                     "https://cdn.shopify.com/s/files/1/1061/1924/products/Disappointed_but_Relieved_Face_Emoji_large.png",
                                     "https://cdn.shopify.com/s/files/1/1061/1924/products/Expressionless_Face_Emoji_large.png"))
  
  
  mydata = data.frame(x = rnorm(100, mean = 50, sd = 20),
                      y = rnorm(100, mean = 50, sd = 5),
                      id = rep(c(1,2,3,4,5), 20))
  
  mydata$y = mydata$y - 10*mydata$id
  
  mydata = mydata %&gt;% left_join(image_links, by='id')
  
  g &lt;- ggplot(mydata) + geom_image(aes(x=x, y=y, image=image), size=0.05)
  
  ggsave(g, filename='[INSERT PATH HERE].png', width=width, height=height, dpi=300)
  </code></pre>
  
  <p>This works fine:
  <a href="https://i.stack.imgur.com/G0ITY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G0ITY.jpg" alt="The emoji&#39;s are displayed fine."></a></p>
  
  <p>The problem arises when you adjust the <code>width</code> and <code>height</code> parameters of <code>ggsave</code>, for instance because you want the x and y-axis to be in the correct proportion:</p>
  
  <pre><code>width = (max(mydata$x) - min(mydata$x))/10
  height = (max(mydata$y) - min(mydata$y))/10
  
  ggsave(g, filename='[INSERT PATH HERE].png', width = width, height=height, dpi=300)
  </code></pre>
  
  <p>The x and y-axis are now fine, but the images are distorted:
  <a href="https://i.stack.imgur.com/7jbKT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7jbKT.png" alt="Emojis are distorted"></a></p>
  
  <p>This happens in ANY situation where you plot an image but the <code>width</code>/<code>height</code> aspect ratio is different than what was the original aspect ratio of the image you want to add.</p>
  
  <p>I'm looking for any solution to this problem, not necessarily restricted to <code>ggimage</code>. It seems very weird to me that you can't properly add images to a ggplot, as I image it's very common for people to want to do that.</p>