Generating .eps figures from array data

I present this as a question and will give my solution (below) because others may have confronted this problem.

I have a large array of data, which I would like to plot in a ListPlot, with axes and labels, export it as .eps to be included in a $\LaTeX$ document. A minimal illustrative case is:

myfig = ListPlot[Table[RandomReal[], {800}, {800}],
ColorFunction -> "Rainbow",
Frame -> True,
FrameTicks -> Automatic]


I export this

Export["/.../myfig.eps", myfig, "EPS"]


and include it in my $\LaTeX$ document only to get an error message that the bounding box cannot be found.

I can Export it in a different format, such as "JPG" or "PNG", but then the ticks and labels are bitmapped and blurry, rather than .eps (or .pdf) and sharp.

How to generate and export the figure such that the final figure will have sharp, high-resolution .eps labels and such?

(I'm running v. 10.4 on a Mac.)

Solution

I found that replacing ListPlot with ArrayPlot and exporting as .eps will solve this problem. Apparently ArrayPlot uses little rectangles as elements (and these can be exported in .eps) while ListPlot generally does interpolation and hence does not give a reasonable .eps file.

Be careful, though: the ordering conventions of ListPlot and ArrayPlot differ, so you must Reverse your data in one of these functions to be visually compatible with the other.

• I think there are system and version issues at play always with eps export. The ListPlot version works fine on windows and opens in acrobat. I can max the zoom at 64x and see nice sharp circles. – george2079 Mar 22 '17 at 18:43
• @george2079: Indeed, version and OS issues are probably at play. Are your ticks and labels in full high resolution (.eps) as well? – David G. Stork Mar 22 '17 at 18:56
• right, its clearly all vector graphics. – george2079 Mar 22 '17 at 19:25