ggsave不限制线宽 [英] ggsave does not constrain line width

查看:284
本文介绍了ggsave不限制线宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



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")

element_line()函数的文档中,没有指定 size 属性。但是,当我在Illustrator中打开生产的pdf时,轴线显示为1.07磅。

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.

所以... 的单位是多少?大小属性,我怎么能实现输出的线宽为0.5pt?

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

推荐答案

转换因子是(72.27 / 25.4)*(72.27 / 96)= 2.141959。所以,正如你注意到的那样, size = 0.5 会产生一个宽度为1.07pt的行。有关详细信息,请参阅此处

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.

这篇关于ggsave不限制线宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆