1
$\begingroup$

Exporting 3d plots to vector files is a longstanding problem:

For density plots a nice option is to rasterise the background image keeping frame, ticks, mesh, contours or other decorations in vector form:

This results in relatively small files since all lines or characters are exported in vector form so we do not need an extremely high resolution.

Is it possible to apply the same idea on 3d plots?

For example, let's consider a simple case of 3d plot

plot = Plot3D[x^2 + y^2, {x, 0, 1}, {y, 0, 1}]

It can be split into an image of the surface from the chosen viewpoint:

plot1 = Plot3D[x^2 + y^2, {x, 0, 1}, {y, 0, 1}, Mesh -> None, 
  BoxStyle -> Opacity[0], AxesStyle -> Opacity[0]]

and a wireframe plot of the mesh, including the box, axes, ticks and labels:

plot2 = Plot3D[x^2 + y^2, {x, 0, 1}, {y, 0, 1}, PlotStyle -> None]

The first component has a rich color variation, so it should be rasterised. The second one should be exported in vector form. However Export to PDF always gives a rasterised image when used on a Graphics3D object (even for a plain wireframe plot) and none of the old tricks in the posts above seems to work on Mathematica v.13.0.1.0. The only option seems to be to transform Graphics3D to Graphics before exporting. The output of Plot3D is essentially a GraphicsComplex so one could try using the 3d to 2d projection method of the following posts:

Exporting the 2d output of the last post, which is a Graphics representation of the original 3d graphics, indeed gives a vector file, so this approach could work. However, I did not manage to make it work on my example plot above, perhaps because of my poor understanding of GraphicsComplex objects.

$\endgroup$

0

Your Answer

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

Browse other questions tagged or ask your own question.