Mathematica doesn't do the best job of exporting figures with shading or transparency to vector graphics formats such as PDF.
A common trick employed here and elsewhere on the web to workaround this is to rasterize just the image portion of the figure and insert this back into a vector version of the axes, labels etc.
The axes are typically converted to a vector drawing by the command:
ImportString[ExportString[axes, "EPS"]]
However this appears to no longer work on V11. More specifically I'm not sure ExportString[axes, "EPS"]]
is behaving as it should, certainly it's output is very different between V10 and V11.
Complete test case:
fig = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]
axes = Graphics3D[{}, AbsoluteOptions[fig]]
ExportString[axes, "EPS"]
Outputs at pastebin:
The V10 output is all understandable and can be correctly imported via ImportString
in both V10 and V11. However the V11 output contains what looks to be compressed data in the form
...g&[ie9oJbc5;SLF=49tG:f #EsI8)63Mg(KS!"/5i2neP :F"d@<>E99o<D$TG[(Zimrd=eIZ2E)DH...
and cannot be imported by either V10 or V11.
So, am I missing something or is ExportString[...,"EPS"]
not working correctly in V11?
If so, what is a suitable workaround?
EDITEDITS
Note also that simply exporting to an EPS figure via Export
also does not produce a vector image.
The option "AllowRasterization -> False"
does not help for either Export
or ExportString
however setting it to True
results in an even more coarsely rasterized image!
Screenshot of a section of the V11 output to show formatting: