1
$\begingroup$

I am having difficulties exporting vector graphics. Using Kardashev3's code provided here:

images = Image[ListPlot[pdata = Table[Sin[2 \[Pi] x/12.34], {x, #}] + 
RandomReal[.1, {#}]]] & /@ Table[i, {i, 100, 200, 10}];

and then exporting them as follows:

Export[NotebookDirectory[] <> "image" <> ToString[#] <> ".eps", 
"AllowRasterization" -> False, Image[images[[#]]]] & /@ Range[Length[images]]
Manipulate[images[[n]], {n, 1, Length[images], 1}]

I get the error message:

<<Export::noelem: {...} is not a valid set of export elements for the EPS format.>>

The code works well for rasterized graphics, but appears to run into problems with vector graphics.

$\endgroup$
1
  • $\begingroup$ Image will represent rasterized graphics, which will not yield vectorized output. You should work with the initial Graphics expression returned by ListPlot. $\endgroup$
    – Yves Klett
    Nov 10, 2013 at 14:43

1 Answer 1

3
$\begingroup$

How about:

Export[
 NotebookDirectory[] <> "image" <> ToString[#] <> ".eps", 
 Image[images[[#]]],
 "AllowRasterization" -> False] & /@ Range[Length[images]]

Edit

I think the OP is asking for this:

plots = ListPlot[
     pdata = Table[Sin[2 Pi x/12.34], {x, #}] + 
       RandomReal[.1, {#}]] & /@ Table[i, {i, 100, 200, 10}];
Export["plot" <> ToString[#] <> ".eps", 
    plots[[#]]] & /@ Range[Length[plots]]

which produces a set of EPS files.

$\endgroup$
6
  • 1
    $\begingroup$ Still rasterizing the image unfortunately $\endgroup$
    – martin
    Nov 10, 2013 at 14:33
  • $\begingroup$ Could it be something in the initial Image line? $\endgroup$
    – martin
    Nov 10, 2013 at 14:34
  • 1
    $\begingroup$ I was addressing the error in your Export code - I don't think you can de-rasterize an Image... $\endgroup$
    – cormullion
    Nov 10, 2013 at 14:34
  • $\begingroup$ Obviously! ;) ... Is it possible to export multiple eps/pdf before they are rasterized, or would individual files have to be exported separately? $\endgroup$
    – martin
    Nov 10, 2013 at 14:46
  • 1
    $\begingroup$ @martin I didn't ask why you were using all those Image commands... :) $\endgroup$
    – cormullion
    Nov 10, 2013 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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