R
问题。
我很困惑width
, height
, dpi
and unit
.
为什么下面两个尺寸不同?
ggsave(filename = "foo.png",ggplot(mtcars, aes(x=wt, y=mpg)) +
geom_point(size=2, shape=23),width = 5, height = 4, dpi = 300, units = "in", device='png')
and
ggsave(filename = "foo.png",ggplot(mtcars, aes(x=wt, y=mpg)) +
geom_point(size=2, shape=23),width = 5, height = 4, dpi = 72, units = "in", device='png')
我将两张图片的尺寸都设置为5(英寸)* 4(英寸)。但为什么当我改变dpi
,尺寸变化?
如何理解之间的关系height
, width
, unit
and dpi
?
或者如何将这四个参数转换为像素单位,这对我来说更容易理解?