0
$\begingroup$

Following the answer given here, I am plotting contour lines in black/white:

data2 = Flatten[
   Table[{x, y, .8 (x + 1)^3 + .4 (y + 1)^2}, {x, -4, 4, .1}, {y, -4,4, .1}], 1];
width = 0.1;
ListContourPlot[data2, 
 Contours -> Flatten@Table[n + width {-.5, .5}, {n, -30, 30}], 
 ContourShading -> {White, Black}, PlotRange -> All, 
 ContourStyle -> Black]

I am then exporting the image. This is just a test data set. The real data set has 100.000 data points and thus the exported image is much larger.

Is there a way to either plot differently or change the plot such that the exported vectorized image is around a few MB?

$\endgroup$
6
  • $\begingroup$ What command do you use to export it? When I enter Export["cplot.pdf", [ListContourPlot[....] ] the result is only 600kB $\endgroup$
    – Jason B.
    Jan 8, 2016 at 15:43
  • $\begingroup$ @JasonB Sorry, I forgot to mention that this is just a minimal example. The real data set is 100.000 entries long, that makes the size grow... $\endgroup$
    – BillyJean
    Jan 8, 2016 at 15:47
  • 1
    $\begingroup$ See my answer here How to export this PDF figure with a small size $\endgroup$
    – user9660
    Jan 8, 2016 at 15:49
  • 1
    $\begingroup$ Ah very good! Then it's only fair if you show your solution as an answer. $\endgroup$
    – user9660
    Jan 8, 2016 at 15:59
  • 1
    $\begingroup$ That is one solution, but you can also keep your data and just rasterize before exporting to pdf, Export["figure.pdf", Rasterize[yourplot, ImageSize -> 600]] and toy with the size to find the right tradeoff. $\endgroup$
    – Jason B.
    Jan 8, 2016 at 16:03

0

Browse other questions tagged or ask your own question.