3

I have the following example

library(ggplot2)
library(ggthemes)
ggplot(mtcars) + 
  geom_point(aes(x = wt, y = mpg, colour=factor(gear))) + 
  facet_wrap(~am) +
  ggtitle("Title") +
  theme(
    axis.line.x = element_line(colour = "black", size = 0.5, linetype = "solid"),
    axis.line.y = element_line(colour = "black", size = 0.5, linetype = "solid")
  )

ggsave(filename = "~/Desktop/test.pdf")

In the docs of the element_line() function it is not specified which unit the size attribute has. But when I open the produced pdf in Illustrator the axis lines are shown as 1.07 pt lines.

So... what is the unit of the size attribute and how can I achieve that the output has a line width of 0.5 pt?

Thanks

Pascal
  • 563
  • 1
  • 3
  • 15
  • Did you look at this ? http://stackoverflow.com/questions/17311917/ggplot2-the-unit-of-size – bVa Apr 07 '16 at 16:36
  • Not specifically, but I already had the idea that it might be a conversion between points and mm. There the factor is 0.35 or 2.83 depending on the direction of conversion. But here the factor is 2.14 (R -> AI) or 0.47 (AI -> R). So, that doesn't work out. – Pascal Apr 08 '16 at 07:22

1 Answers1

1

The conversion factor is (72.27/25.4)*(72.27/96)=2.141959. So, as you note, size=0.5 results in a line that is 1.07pt wide. See here for details.

Claus Wilke
  • 16,992
  • 7
  • 53
  • 104