pdf('test.pdf')plot(1:10, type='o', lwd=2, axes=F)And then you open the PDF in Illustrator, you will see the border width is 0.75pt, and the line is 1.5pt, which seems that the unit of 1 in R is 0.75pt in Illustrator.
How is this defined? Where can I change it?
I found the answer by switching the display unit of stroke in Illustrator (see below) from point to inch. It shows 1point=1pixel=0.0139inch=1/72 inch in Illustrator.
And in the R document of points(), it says:
pch = "."(equivalently
pch = 46) is handled specially. It is a rectangle of side 0.01 inch (scaled by
cex). In addition, if
cex = 1(the default), each side is at least one pixel (1/72 inch on the
For other text symbols,
cex = 1corresponds to the default fontsize of the device, often specified by an argument
0:25the default size is about 75% of the character height (see
So, when saved into pdf, a point without scaling in R is one rectangle with one pixel each side, also 1/72 inch, which means the size of basic unit of R and illustrator should be same. But why lwd=1 will result in 0.75pt=3/4pixel in Illustrator? Is it set in PDF output?
OK. The answer is already in the pdf() document:
Line widths as controlled bySo, lwd=1 is equal to 1/96 inch, which is exactly as 0.75 * 1/72 inch (0.75pt). To change it, for example if we want to set line width as 0.5 pt in Illustrator, we can set lwd=2/3, as below:
par(lwd = )are in multiples of 1/96 inch. Multiples less than 1 are allowed.
pch = "."with
cex = 1corresponds to a square of side 1/72 inch, which is also the ‘pixel’ size assumed for graphics parameters such as
pdf('test2.pdf')But I found this does not control the line width of axis and legend, which have to be set in the function itself.
btw, I have not figured it out how to get same setting for stroke line in R and in Illustrator. I was setting lty='32', lwd=2/3 in R, assuming that I can get stroke line as dash=1.5pt and gap=1pt in Illustrator, but actually I did not. Don't know why. If anyone can figure it out, please let me know.