# line width in R and in Illustrator

**One Tip Per Day**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’ve drawn figure in R with lwd=1, e.g.

pdf(‘test.pdf’)plot(1:10, type=’o’, lwd=2, axes=F)

box(lwd=1, col=’red’)

dev.off()

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**.

**1point=1pixel=0.0139inch=1/72 inch in Illustrator.**

Value

`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`postscript`

and`xfig`

devices).

For other text symbols,`cex = 1`

corresponds to the default fontsize of the device, often specified by an argument`pointsize`

. For`pch`

in`0:25`

the default size is about 75% of the character height (see`par("cin")`

).

Line widths as controlled by

`par(lwd = )`

are in multiples of 1/96 inch. Multiples less than 1 are allowed.`pch = "."`

with`cex = 1`

corresponds to a square of side 1/72 inch, which is also the ‘pixel’ size assumed for graphics parameters such as`"cra"`

.

So, 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:

pdf(‘test2.pdf’)

par(lwd=2/3)

plot(1:10, type=’o’)

dev.off()

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.

**leave a comment**for the author, please follow the link and comment on their blog:

**One Tip Per Day**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.