I have generated some tiff files containing R plots using the following general approach:
df2 <- data.frame('x_axis' = seq(-10000,10000),
'y_axis' = seq(1,20001))
tiff(file = 'test_size_090523_1.tiff',
units = 'in',
width = 6,
height = 6,
res = 300)
plot(x = df2$x_axis,
y = df2$y_axis,
type = 'l')
dev.off()
This figure should come out as a square, 6 inches on each side. If I "place" (Adobe's term) one of these plots onto an "artboard" of a defined size in Adobe Illustrator, sometimes the plot is exactly as it should be, i.e. a square, 6 inches on each side; other times, it's much bigger. The code above should work as a reproducible example in which it the output file is much too big. Specifically, in this case (as in the other cases when I have checked), Adobe Illustrator says that the plot is 25 inches on each side.
I would very much appreciate any suggestions for what is going on or how to fix this.
Thanks for the response. I had mentioned Illustrator just as an explanation for how I was determining the size of my output plots.
If I set res = 72, I get exactly 6 inches square, but I don't want res = 72. I'm making the plot for a figure in a journal that asks that the figures be 20 cm wide with a resolution of 300 dpi, which, if I understand correctly, means that res should be set to 300. Also, in other instances where I am creating line plots in R with the same number of points entered in to determine the lines, I can enter res = 300 with the same other parameters, and I get an output that is precisely 6 inches on the side.
Hi @efoss,
This is definitely a problem with Illustrator not R. When I open the tiff file created by your code in either Windows Photo Viewer or GIMP, the image is square with a resolution of 300 dpi and a size of 1800 x 1800 pixels.
I wonder why Illustrator sometimes gives me something that is precisely the correct size (6 inches on the side), and other times gives me precisely 25 inches on a side, even when I enter the same number of data points to specify each side of the square. I'll redirect my question to Illustrator. Thanks very much for looking into it. It's good to know that I'm not making a mistake in my R code.