Bug persisting in 13.1.0 [CASE:4953032]
For antialiased export, I'm using the following pattern:
Rasterize[Style[plot, Antialiasing -> True], ImageSize -> 800,
RasterSize -> 1600]
However, this introduces "polygon" artifacts in my RegionPlot plots, any tips for a way around it?
nf[x_] := NumberForm[x, {3, 3}];
rotateVec[angle_, vec_] := N[RotationMatrix[angle] . vec];
simpleNorm[{{a_, b_}, {c_, d_}}] :=
Max[Sqrt[
a^2 + b^2 + c^2 + d^2 -
Sqrt[-4 (b c - a d)^2 + (a^2 + b^2 + c^2 + d^2)^2]]/Sqrt[2], Sqrt[
a^2 + b^2 + c^2 + d^2 +
Sqrt[-4 (b c - a d)^2 + (a^2 + b^2 + c^2 + d^2)^2]]/Sqrt[2]];
xvec1 = {1, 0};
getBatch[theta_] := {1/2 xvec1, rotateVec[theta, xvec1]};
standardColors = ColorData[97, "ColorList"];
d = 2;
ii = IdentityMatrix[d];
bound = 2.;
setTheta[t0_] := (
theta = t0;
H = With[{X = getBatch[theta]}, X . X[Transpose]];
Ta[alpha_] := ii - 2 alpha H + alpha^2 H . H;
obj[alpha_] := simpleNorm@Ta@alpha;
sol = NMinimize[obj[alpha], alpha];
point = {alpha /. Last[sol], First@sol};
curvePlot =
Plot[Norm@Ta@alpha, {alpha, alphaStart, alphaEnd},
Epilog -> {PointSize[Large], Red, Point[point]},
AxesOrigin -> {0, 0}];
tracePlot =
Plot[Tr@Ta@alpha, {alpha, alphaStart, alphaEnd},
PlotStyle -> {Directive[Dashed, standardColors[[2]]]}];
arrowsPlot = Graphics[Arrow[{{0, 0}, #}] & /@ getBatch[theta]];
);
genPlot[alpha_] := Module[{},
alphaStart = 0;
alphaEnd = 3.;
mat0 = Ta[alpha];
R = Norm[mat0];
curvePositionPlot =
ListPlot[{{alpha, Norm@mat0}}, Filling -> Axis,
PlotStyle -> PointSize[Large], FillingStyle -> Dashed];
curvePositionPlot2 =
ListPlot[{{alpha, Tr@mat0}}, PlotStyle -> PointSize[Large],
FillingStyle -> Dashed];
boundsPlot0 =
ContourPlot[{{x1, x2} . ii . {x1, x2} ==
R, {x1, x2} . ii . {x1, x2} == Tr@mat0}, {x1, -bound,
bound}, {x2, -bound, bound}, Frame -> False,
ContourStyle -> {standardColors[[1]],
Directive[standardColors[[2]], Dashed]}];
boundsPlot1 =
RegionPlot[{x1, x2} . PseudoInverse[mat0] . {x1, x2} <=
1, {x1, -bound, bound}, {x2, -bound, bound},
PlotStyle -> standardColors[[3]]];
boundsPlot = Show[boundsPlot0, boundsPlot1, arrowsPlot];
curvePlot0 =
Show[curvePlot, curvePositionPlot, tracePlot, curvePositionPlot2,
PlotLabel -> StringForm["trace=norm=", nf@Tr@mat0, nf@R]];
GraphicsRow[{boundsPlot, curvePlot0}, 0, Spacings -> 0]
];
linePlot =
ContourPlot[{x1, x2} . CholeskyDecomposition[H] == 0, {x1, -bound,
bound}, {x2, -bound, bound},
ContourStyle -> Directive[Orange, Dashed],
PlotLabel -> StringForm["step=``", k]];
setTheta[Pi/4];
Rasterize[Style[genPlot[0.5], Antialiasing -> True], ImageSize -> 800,
RasterSize -> 1600]

