Using:
ggplot(mtcars, aes(mpg, wt)) + geom_point() + coord_fixed(ratio = 1) + ggsave('plot.jpg', width = 6, height = 1.5, dpi = 300)
You get a plot with fewer spaces:

Another option would be to use a png or jpeg device:
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() + coord_fixed(ratio = 1) jpeg('plot.jpg', width = 600, height = 150) p dev.off()
source share