I am using m1 Mac. When I use ggsave to save a 300 dpi png or other formats, Mac always will convert it to 72 dpi.
For example,
library(tidyverse)
a <- ggplot(mtcars, aes(x=wt, y=mpg)) +
geom_point(size=2, shape=23)+
theme_bw(base_size = 11)
ggsave(filename = "figure1.png",
a,
width = 2.14, height = 1.51, dpi = 300,units = "in")
I searched very hard but there are few useful answers on the Internet. But I found if I add type = "cairo" in ggsave, I can have the right dpi 300 figures.
ggsave(filename = "figure2.png",
a,
width = 2.14, height = 1.51, dpi = 300,units = "in",
type = "cairo")
Do you know the reason for this problem? I am so confused even though I found the type = "cairo" trick.