Skip to main content
13 events
when toggle format what by license comment
Oct 10, 2019 at 15:30 comment added Henrik Schumacher Ah, the notorious Rosenbrock function!
Aug 25, 2019 at 8:32 history edited Szabolcs CC BY-SA 4.0
update rasterizeBackground for recent M versions
Sep 6, 2017 at 11:16 history edited Szabolcs CC BY-SA 3.0
added 113 characters in body
Apr 13, 2017 at 12:55 history edited CommunityBot
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
May 22, 2015 at 13:22 comment added Emilio Pisanty @Szabolcs This is excellent, but it somehow seems to sometimes increase the footprint of the image. For plot=ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, Contours -> 20], running ByteCount[plot, cleanContourPlot[plot] returns roughly {2.3MB, 5MB}. I find this completely befuddling - you've removed a bunch of points and the information on how to connect them, so the footprint should decrease. Maybe the data structure is less efficient? Any thoughts on why this should be the case?
Apr 6, 2012 at 2:54 comment added Guillochon This works absolutely splendidly, preserving all the features of ContourPlot while solving its one major shortcoming. Well done.
Mar 21, 2012 at 9:41 history edited Szabolcs CC BY-SA 3.0
added 58 characters in body
Mar 21, 2012 at 0:03 comment added Mr.Wizard As a v7 user I cannot test this but +1 for effort if nothing else!
Mar 20, 2012 at 23:18 comment added Jens @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.
Mar 20, 2012 at 23:17 comment added s0rce 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.
Mar 20, 2012 at 22:31 comment added Szabolcs @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!
Mar 20, 2012 at 22:07 comment added F'x 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.
Mar 20, 2012 at 21:31 history answered Szabolcs CC BY-SA 3.0