i am plotting some data in R using the following commands:
jj = ts(read.table("overlap.txt"))
pdf(file = "plot.pdf")
plot(jj, ylab="", main="")
dev.off()
The result looks like this:

The problem I have is that the pdf file that I get is quite big (25Mb). Is the a way to reduce the file size? JPEG is not an option because I need a vector graphic.
Take a look at
tools::compactPDF– you need to have either qpdf or ghostscript installed, but it can make a huge difference to pdf file size.If reading a PDF file from disk, there are 3 options for GostScript quality (
gs_quality), as indicated in the R help file:printer(300dpi)ebook(150dpi)screen(72dpi)The default is
none. For example to convert all PDFs in foldermypdfs/toebookquality, use the commandtools::compactPDF('mypdfs/', gs_quality='ebook')