I'm trying to export a figure with dimensions 90x150 mm with 300 dpi using the ggsave() and Cairo(). The problem is that even though I correctly specified the figure dimensions on the code, they ended up far bigger then expected (281x468 mm). Here's the code I've been using:
x <- 1:10; y = x*x
plot = qplot(x, y, geom=c("point", "line"))
#ggsave
ggsave(plot, filename = "test.png",
width = 90, height = 150, dpi = 300, units = "mm", type = "cairo")
#Cairo
Cairo(90, 150, file="test2.png", type="png", bg="white", res = 300, units = "mm")
plot
dev.off()
Just figured out that Cairo() and ggsave() size output is affected by the image resolution, even if you choose a "metric" dimension as output.
So basically, if you want a 90x150 figure at 300 dpi, you have to divide by 3 this dimensions (since 300 dpi is 3x the default resolution, 100dpi). Your setup then will be 30x50.