2
$\begingroup$

I have the following code that runs a RegionPlot

Clear[Rg3, SetRg3, Ig3, SetIg3, κ1, Setκ1, Γ, SetΓ, κ2, Setκ2, g1, Setg1, g2, Setg2, r1]
Setκ1 = 1; SetΓ = 0.01; Setκ2 = 20;
r1 = RegionPlot[SetRg3 = 0; SetIg3 = 0; 
NMG3 = {{-Γ/
  2, -I*g1, -I*Rg3 + Ig3}, {-I*g1, -κ1/
  2, -I*g2}, {-I*Rg3 - Ig3, - I*g2, -κ2/2}} /. {Rg3 -> 
  SetRg3, Ig3 -> SetIg3, κ1 -> 
  Setκ1, Γ -> 
  SetΓ, κ2 -> Setκ2, g1 -> Setg1, 
 g2 -> Setg2};
EigensysNMG3 = 
Eigensystem[NMG3, Cubics -> True]; {Chop[
Min[{((Abs[
       Normalize[
         EigensysNMG3[[2]][[1]]] /. {κ1 -> 
          Setκ1, Γ -> 
          SetΓ, κ2 -> Setκ2, 
         g3 -> Setg3}]).Transpose[{{1, 0, 0}}]), ((Abs[
       Normalize[
         EigensysNMG3[[2]][[2]]] /. {κ1 -> 
          Setκ1, Γ -> 
          SetΓ, κ2 -> Setκ2, 
         g3 -> Setg3}]).Transpose[{{1, 0, 0}}]), ((Abs[

       Normalize[
         EigensysNMG3[[2]][[3]]] /. {κ1 -> 
          Setκ1, Γ -> 
          SetΓ, κ2 -> Setκ2, 
         g3 -> Setg3}]).Transpose[{{1, 0, 0}}])}] >= 
 RankedMax[{((Abs[
        Normalize[
          EigensysNMG3[[2]][[1]]] /. {κ1 -> 
           Setκ1, Γ -> 
           SetΓ, κ2 -> Setκ2, 
          g3 -> Setg3}]).Transpose[{{1, 0, 0}}])[[1]], ((Abs[
        Normalize[
          EigensysNMG3[[2]][[2]]] /. {κ1 -> 
           Setκ1, Γ -> 
           SetΓ, κ2 -> Setκ2, 
          g3 -> Setg3}]).Transpose[{{1, 0, 0}}])[[1]], ((Abs[
        Normalize[
          EigensysNMG3[[2]][[3]]] /. {κ1 -> 
           Setκ1, Γ -> 
           SetΓ, κ2 -> Setκ2, 
          g3 -> Setg3}]).Transpose[{{1, 0, 0}}])[[1]]}, 
  2]]}, {Setg1, 0.01, 10}, {Setg2, 0.01, 12}, PlotRange -> Full, ImageSize -> Large, PlotLegends -> Automatic, PlotPoints -> 100, PlotStyle -> Directive[Red, Opacity[0.35]], PlotRangePadding -> None, BoundaryStyle -> None, Mesh -> None]

which generates enter image description here

Now I need it to be in vector format so I did Export["r1.pdf", r1]. However, there are these polygons/triangles that shows up and it becomes really inconvenient for me to when doing post editing on Inkscape. I have included the zoomed in example below enter image description here

As one can see, there are faint lines of triangles that are tiled in there. Removing them is what I'm trying to do.

Now I understand that this seems to be a common question upon Googling. However, none of the solutions worked for me in that it did not achieve what I want (namely, have it to be still vectorized, minus the triangles) or they were too difficult for me to understand and implement. For example, I have tried

Export["r1.pdf", 
Show[r1, 
Prolog -> {Opacity[0], Texture[{{{0, 0, 0, 0}}}], 
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}}, 
Polygon[{{0, 0}, {.1, 0}, {.1, .1}}]}]
]

which seems to do the trick. However, I need to post process it on Inkscape. But doing

Export["r1.svg", 
Show[r1, 
Prolog -> {Opacity[0], Texture[{{{0, 0, 0, 0}}}], 
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}}, 
Polygon[{{0, 0}, {.1, 0}, {.1, .1}}]}]
]

Doesn't seem to vectorize it properly (while removing the triangles). I still see course pixels upon opening r1.svg on Inkscape.

Appreciate any help that I can get. Thanks for reading.

$\endgroup$
2
  • 1
    $\begingroup$ You need only the boundary right? The vector graphics programs can typically fill it on their own. So try to export BoundaryDiscretizeGraphics[r1] instead. $\endgroup$ – Henrik Schumacher May 25 '20 at 7:45
  • $\begingroup$ do you get what you need if you export r2 = r1 /. {EdgeForm[], d_, p___} :> {EdgeForm[DeleteCases[_EdgeForm]@d], d, p} instead of r1? $\endgroup$ – kglr May 25 '20 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.