0
$\begingroup$

I'm trying to export and eps file from a plot which contains a ListPlot with Filling

n = 1024;
x = Table[N[xdum], {xdum, 0, 1, 1/n}];
y = Cos[2 \[Pi] x];
ListPlot[{x, y}\[Transpose], PlotRange -> {{0, 1}, {-1, 1}}, 
Filling -> 0]

the dimension of the file is huge. Does anyone have some idea to overcome this problem? I was trying to use Rasterize and then Show, but I can not get the right image scaling.

$\endgroup$
  • $\begingroup$ What do you mean by "huge"? Also, is there a reason for using ListPlot rather than Plot? $\endgroup$ – A.G. Mar 3 '15 at 16:05
  • $\begingroup$ ListPlot together with Filling produces per each point a vertical line used to fill the graph. When a lot of points are used the exported vector images, e.g. eps, is a huge file. $\endgroup$ – Fabio Mar 4 '15 at 18:21
1
$\begingroup$

This works,

  plot=ListPlot[{x, y}\[Transpose], PlotRange -> {{0, 1}, {-1, 1}}, 
    Filling -> 0];
  Export[ "test.eps"  , Rasterize[plot, ImageSize -> 1000]];

The file size is reduced from 140k ( hardly "huge" ) to 30k, with a noticeable loss of quality.

If you are concerned with the displayed size of the figure that is normally dealt with in whatever application you use to import the eps.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.