9
$\begingroup$

Consider the following simple example code:

plot3D = ListPlot3D[{{0, 0, 1}, {1, 0, 0}, {0, 1, 0}}, Mesh -> All];
Export["plot3D.pdf", plot3D]

As clearly seen, the output is not a vector graphics.

How can I export a 3D image into a vector graphics?


Second edit:

Workaround given in answer to linked question

First edit

Unfortunately, the solutions proposed in the linked answer, do not really work. For example consider the following plot, as shown inside Mathematica (code on this gist): enter image description here

This plot is built entirely using Graphics3D primitives, if that matters, so it should be relatively easy to export as vector graphics (I guess).

Exporting it directly with Export["out.pdf",plot] produces a rasterized output.

Using the second solution of Jens in the linked answer, i.e.:

Export["out.pdf",Graphics[Inset[plot, Automatic, Automatic, Scaled[1]]]]

produces the following (obviously not right) vector graphics:

enter image description here

The other solution of directly printing into pdf does not work either: using the default Windows 10 pdf printer gives a rasterized image, while printing with the Foxit Reader Pdf printer gives the following truncated image:

enter image description here

So, aren't there other solutions to obtain a vector graphics with Mathematica?

$\endgroup$
19
  • 1
    $\begingroup$ When I exported it as svg, and looked at the .svg file using editor, I see Mathematica is actually making .png image inside and just encoding the image data. Here is the line: <image id="image83" width="360" height="287" xlink:href="data:image/png;base64,iVBOR..... so it looks like Mathematica does not really support true svg. It just wraps the png encoded data inside an svg file! $\endgroup$
    – Nasser
    Nov 22, 2015 at 18:14
  • 1
    $\begingroup$ @Nasser that is indeed what you also see by exporting into pdf. Exporting 2D plots results in clearly vector graphics object, exporting 3D plots does not. My question is therefore if there is a way around this problem, eventually (but preferably not) using some external tools. $\endgroup$
    – glS
    Nov 22, 2015 at 18:26
  • 1
    $\begingroup$ May be this was done as temporary solution until WRI adds true vector graphics export to 3D plots. May be in version 11 it will do true svg for 3D. $\endgroup$
    – Nasser
    Nov 22, 2015 at 18:32
  • 2
    $\begingroup$ Why don't you export it as an EPS Export["plot3D.eps", plot3D,"EPS"]? $\endgroup$
    – Vaggelis_Z
    Nov 22, 2015 at 18:46
  • 1
    $\begingroup$ I have reproduced your result. The key is addition of the option ImageSize -> 1000 in GraphicsRow. The same result can be achieved with Graphics[Inset[pl], ImageSize -> 1000] (where pl is your plot). $\endgroup$ Nov 24, 2015 at 9:40

0