Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • $\begingroup$ Many thanks for this answer (and code)! It gets the original 836 kB PDF file to a 239 kB one, so it's still heavier than the RegionPlot-based approach but probably closer to the original ContourPlot (because it's derived from it) and thus more failure-resistant. $\endgroup$ Commented Mar 20, 2012 at 22:07
  • $\begingroup$ @F'x I think the size also depends on how details the (adaptive) sampling ends up being. With MaxRecursion -> 0 the file should be smaller and of worse quality. I'm sure RegionPlot and ContourPlot will differ in how many sampling points they use. Sorry about posting this in a rush, I wrote it on the train while I was offline. I'll read it through again tomorrow. Good night! $\endgroup$ Commented Mar 20, 2012 at 22:31
  • $\begingroup$ Is it possible to generalize this to other mathematica graphics. 3D graphics like a sphere or a pyramid with shading show similar edge artifacts in the PDF. $\endgroup$ Commented Mar 20, 2012 at 23:17
  • 3
    $\begingroup$ @Szabolcs cleanContourPlot seems to work very well, even on ListContourPlot. With the RegionPlot approach of this question, one could also write a cleanContourPlot function, but now there isn't much motivation for that. Next time you could take the bus, then all our plot problems will be fixed. $\endgroup$ Commented Mar 20, 2012 at 23:18
  • $\begingroup$ As a v7 user I cannot test this but +1 for effort if nothing else! $\endgroup$ Commented Mar 21, 2012 at 0:03