Minimal working example:

Export["test.pdf", DensityPlot[1/(x^2 + y^2 + 1), {x, -5, 5}, {y, -5, 5}, PlotRange -> All]]
Export["test.svg", DensityPlot[1/(x^2 + y^2 + 1), {x, -5, 5}, {y, -5, 5}, PlotRange -> All]]

The pdf has vector text (paths, I guess), but the svg file is very pixelated, and really just seems to be a png or some such imported into an empty svg file. How can I get Mathematica to output the axes and especially the labels as paths?

I've tried this answer, which does the trick, but totally mangles the plot itself

Edit: Following Jens comment below, using contourDensityPlot from this answer worked fine for both pdf and svg formats, both for axes and labels and for the plot itself.

  • $\begingroup$ The failure of my linked answer seems to be a bug in PDF import. This bug doesn't appear in version 8, but I do see it in version 10. $\endgroup$
    – Jens
    Mar 11 '15 at 17:29
  • $\begingroup$ Does it work if you use the function contourDensityPlot from this answer? $\endgroup$
    – Jens
    Mar 11 '15 at 17:40
  • $\begingroup$ @Jens: Yes, it does! The contourDensityPlots look fine and vectory in both versions (btw, the contourRegionPlots do, too). What is the etiquette, here? Do I mark this as answer now, or does the bug (I guess) in Mathematica, and the fact that it's a workaround to something that should work out of the box, preclude a "answered" mark? $\endgroup$ Mar 12 '15 at 12:59
  • $\begingroup$ I think I'll write an answer now to propose the contourDensityPlot approach as a workaround... you application is not directly a duplicate, and there may be other answers as work-arounds to your issue. $\endgroup$
    – Jens
    Mar 12 '15 at 16:15

This is not supposed to happen, but indeed the SVG output is rasterized. It happens when you use DensityPlot, but not with ContourPlot (in version 8 at least). So I think this is a bug. To keep the axes as vector graphics, I would suggest my answer here as a work-around.


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.