Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

My question concerns the size of exported eps files that were created using density, contour, vector-field, and/or streamline plots: these files are so huge that whenthey are are inserted into a LaTeX manuscript (using \includegraphics) and a PDF file is created for printing (or viewing on screen), the time to render those pages in the PDF plot is extreme. Typical file sizes range from on the order of 600,000 to 4,400,000, depending on how I tweak various options to the plot commands. At prior suggestions of various people I’ve tried tweaking many of the myriad options for these commands, both individually and in combination (including PlotPoints). By doing so, I can induce minor changes in the size of exported files, but nowhere near enough to make this viable. [The, to me, obvious idea of wrapping the name of the plot in Rasterize (within the Export command) does radically shrink the size of the exported graphic but at way too high cost: of so much loss of clarity as to defeat the purpose of including the graph in the manuscript in the first place.] To illustrate the effects of a few of these tweaks I’ve tried, here is a little data table:

No tweaks:                          759,192
    NormalsFunction->None           759,189
    Mesh->Full                      759,189
    MaxRecursions->2               4,460,439
    Rasterize (in Export)           224,000

From my research on the internet, I deduce that this is a common problem. There to be no simple fix I have tried some things suggested by at various sites---multi-step methods involving generating the plots in four or five separate graphics commands (axes, content, color, etc.), then combining them using Show. So far, everything I’ve tried works on the test cases posted where I found the idea but not for my graphs, and because the explanations are absent or lacking, I’ve not been able to figure out how these fixes work well enough to adapt them intelligently to my needs. This issue is important for me: I'm preparing final graphs for a long book, which contains many tens of plots of this type.

Yesterday, for example, I tried to print the draft of a chapter that contains four of these density plots. The printer hung when it hit the page of the PDF file that contained the first of these density plots and remained hung for 8 hours, after which time I killed the job. (When I used the option draft->true, to \includegraphics, the file printed in about 2 minutes. Of course, it contained none of the figures, since this option includes in your PDF file not the figure but the full file name of the figure---not what one would need while revising or to give to students or colleagues for comment or to post on a web site or to send to a journal).

On reflection, I find it hard to believe that there is not some straightforward way within Mathematica to fix this problem. But, hunt as I might on Wolfram’s site, I’ve not been able to find enough guidance to reduce, let alone solve, the problem. My friend and colleague Paul Abbott, whom I queried about this issue, suggested that I post this information here. Any help would be most appreciated! Thanks a lot.

A couple of people offered the useful suggestion that I try a fix posted elsewhere on this site, a fix designed for 3D plots that adds a Prolog to all 3D plots that forces the conversion to bitmap upon export. This does, indeed, shrink the size of 3D plots appreciably but does not affect the size of the 2D plots that are the topic of this question.

share|improve this question
    
Related questions: (1542), (1720), (5132). –  Silvia Apr 1 at 6:00
    
Try the function rasterTrick from my answer here. –  Jens Apr 1 at 6:02
    
Also you can try this trick to reduce the data size of the vector graphics. –  Silvia Apr 1 at 6:11
    
1  
I cannot reproduce the problem with VectorPlot/StreamPlot. (Other commands, yes, produce huge files.) Have you tried exporting to PNG or JPG with a high/appropriate resolution? The file can be large but renders fast, faster than a rasterized image. –  Michael E2 Apr 1 at 12:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.