4

This problem does not exist in 13.2.1 anymore


I often need to export some svg with mma, but RegionPlot's diagrams will have some extra mesh after exporting SVG:

p = RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}];
Export["p.svg", p]

enter image description here

Not only does this make SVG very ugly, but it can lead to very large files. And is this a bug of MMA?

yode
  • 26,686
  • 4
  • 62
  • 167

2 Answers2

6
p = RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}, 
   PlotStyle -> {EdgeForm[]}];
Export["p.svg", p]

enter image description here

pp= RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}, 
   PlotStyle -> {EdgeForm[], FaceForm[Green]}, 
   BoundaryStyle -> None];
Export["pp.svg", pp]

enter image description here

ppp = RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}, 
   PlotStyle -> {EdgeForm[], FaceForm[None]}, BoundaryStyle -> Red];
Export["ppp.svg", ppp]

enter image description here

cvgmt
  • 72,231
  • 4
  • 75
  • 133
3

This code almost solves my problem, which will export very small and meshless SVG file, but the background is not transparent. I don't know how to export an SVG file with the transparent background..

p = RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}];
BoundaryDiscretizeGraphics[p, Frame -> True];
Export["p.svg", %,Background -> None]
yode
  • 26,686
  • 4
  • 62
  • 167