# Getting Mathematica 9 to export text and axes of a plot as vector graphics in SVG

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.

• 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. – Jens Mar 11 '15 at 17:29
• Does it work if you use the function contourDensityPlot from this answer? – Jens Mar 11 '15 at 17:40
• @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? – GeckoGeorge Mar 12 '15 at 12:59
• 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. – 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.