1

I have 3 millions data points and plotted in R as a point. Then I save my plot as pdf file. This works great, but when I open the file it takes time to display all points. Actually it shows like an animated plot. My questions are:

(1) how can I display this plot as an image, i.e no animation.

(2) how to reduce the size keeping good resolution. My original data takes about 10MB and not suitable for publication.

To demonstrate this, use the following code, open pdf document and check the animation.

f<-rand(3E5,2)*1E4
pdf(file="test.pdf")
plot(f[,1],f[,2], type="p",cex=0.1)
graphics.off()
bell
  • 191
  • 1
  • 1
  • 11
  • 2
    I'd think *"good resolution"* (addressed by DPI and image dimensions), *"small size"*, and avoiding your *"animated plot"* issue are completely at-odds with each other. To avoid your "animation" problem, you need to either sample your data (might not be possible) or go with a raster solution (png, jpg, bmp) vice a vector one (svg, pdf). – r2evans Aug 09 '19 at 21:35
  • closely related: https://stackoverflow.com/questions/10945707/speed-up-plot-function-for-large-dataset/10946907#10946907 – Ben Bolker Aug 09 '19 at 21:55
  • I don't think it's covered in the linked question, but a PNG with insanely high resolution will still not be very large (since the giant blob in the middle is treated as a single blob by the PNG compression algorithm; only the edges of the blob add to the size of the image as the resolution increases) – Ben Bolker Aug 09 '19 at 22:03
  • I just added another answer to that question showing the PNG solution. – Ben Bolker Aug 09 '19 at 22:12
  • Thanks Ben. I am plotting bifurcation diagram. If I use png, the picture is not clear and misses important regions of the diagram. I either have choice to use pdf or eps for clear picture. Is there any possibility to make it non-animated. I tried to reduce density using convert command in linux, it reduces size, make it non-animated but very poor quality. But It is better than png in this case. Any other possible solution? – bell Aug 09 '19 at 23:08

0 Answers0