Data Visualisation with R
Both figures used the same code below to produce the figure:
ggplot(cars, aes(speed, dist)) + geom_point()
but I saved one to a png file and the other as a svg file.
jpg
(or jpeg
) uses a lossy data compression that results in some loss of information but usually a small file size.png
uses a lossless data compression and works well if the image has uniform colors.svg
, pdf
and eps
. E.g. svg and its source.ggplot2
, use ggsave()
.