0

I'm trying to make a plot in R using ggplot and geom_image, but the images are too blurry for my liking. Is there something I can do? What I am seeing

I have tried to search for many different images and they all seem to suffer from the same problem.

ggplot(data = Starters, aes(x = ORTG, y = DRTG)) + 
       geom_point() +
       geom_vline(xintercept = mean(Big_12_starters$ORTG)) +
       geom_hline(yintercept = mean(Big_12_starters$DRTG)) +
       geom_image(aes(image = Image_path), size = .06) +
       scale_size_identity() +
       labs(title = "Offensive and Deffensive Rating for Big 12 Starting Lineups") +
       xlab("Offensive Rating") +
       ylab("Defensive Rating") +
       annotate("text", x = 100, y = 80, label = "Good Defense / Bad Offense") +
       annotate("text", x = 95, y = 100, label = "Bad Defense / Bad Offense") + 
       annotate("text", x = 112, y = 97, label = "Bad Defense / Good Offense") + 
       annotate("text", x = 115, y = 80, label = "Good Defense / Good Offense")
  • 3
    I suspect the isue is with the resolution of the source images rather than your code. What are the pixel dimensions of your source images? With what quality were they saved? Were they saved lossily or losslessly? The simplest solution might simply be to get higher resolution source images. – Limey Jan 28 '23 at 07:40
  • You might also check if the results vary depending on your graphics device. For instance, the default Windows device in the Plot window does not anti-alias, (which looks like the issue) so you might have better results if you switch your graphics backend in Global Options to Cairo or ragg. You can also specify these with `ggsave`. – Jon Spring Jan 28 '23 at 20:15

0 Answers0