R
question.
I got so confused by the width
, height
, dpi
and unit
.
Why the following two size different?
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')
I set both of the picture's size 5 (inches) * 4 (inches). But why when I change the dpi
, the size changes?
How to understand the relationship between height
, width
, unit
and dpi
?
Or how to translate these four parameters into unit of pixels, which is easier for me to understand?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…