Using Stata, I produced a scatter plot of some variables. I saved the image as an EPS file. There are around a 1000 dots in the scatter plot – and this makes the EPS file to be 26MB. I need to use this image in my LaTeX file (I use TeXnicCenter and compile as LaTeX => PS => PDF
). The problem is that it produces a PDF file that takes a long time to load the page displaying the image. I don't need this image to be super sharp – there is no real point in zooming it in too much. Furthermore, the PDF I get is quite heavy for a 16 pages document. Is there anything I could do to improve the loading time of the page with the drawing, and decreasing the size of the PDF file? For example,
-
Would it be an improvement if I convert the image to JPEG, PNG, or BMP? Would it decrease the image size?
-
Is there a way to tell LaTeX to keep using the EPS image, but decrease the quality of the image?
Best Answer
As noted in the comments on the question, EPS is not an ideal way to store the plot. For scatter plots with many points and also for pseudo colour plots, it's a better idea to store the plot itself (without axes and annotations) as a raster graphic such as a PNG. In the case of a pseudo colour plot, this is actually minimal and no information is lost. See this answer for an example I did of one.
As a sample, I plotted random points in
octave
and then turned off the axes. After saving as a PNG file, I usedimagemagick
to trim the margins from the plot to produce scatter.png:Using
pgfplots
I wrapped this PNG in axes, thus minimising the the space and processing required by the points in the plot. This requires the use ofpdflatex
rather thanlatex
with a PNG file.