I am learning ggplot2 and try to use the ggsave() method to save my plot to a picture. I want my final graph to be 300 dpi, but no matter how I change the 'dpi=' value, what I finally got was only a graph with 72 Pixels/Inch, so what is the problem with my code?
ggsave(filename="./test4.jpg", units = "in", width =20, height = 10, dpi = 300, device='jpg')
I also tried the solution proposed by others before, I still got a graph of 72 dpi:
tiff("test.tiff", units="in", width=5, height=5, res=300)
# insert ggplot code
dev.off()