# How to get a smooth, uniform ParametricPlot of a 2D Region?

This is an offspring of this question.

How to get a nice, smooth, uniform plot of the following? I.e. with no horizontal lines, and no ragged boundary at the top. I went with PlotPoints up to 400 and I'm dissapointed. What I'm actually after is a nicely Exported .pdf.

ParametricPlot[{{1 + a1/(-1 + a2),
1 - 2 ArcCsc[2/Sqrt[1 + a1 - a2]]/π},
a2 >= -1 && 1 + a1 >= a2 && a1 + a2 <= 1}, {a1, -2, 2}, {a2, -1,
1}, Frame -> True, PlotRange -> {{0, 2}, {0, 1}},
AspectRatio -> 1/GoldenRatio, PlotPoints -> 150] // Quiet


• ParametricPlot doesn't allow constraint to be passed in that way. – Chip Hurst Sep 28 '19 at 13:21

To avoid the artifacts from singularities and jumps, we can take a somewhat manual approach.

Notice that the bottom boundary is formed from a2 == -1, the top boundary is a horizontal line formed as a2 -> 1 from the left, and the left boundary is a vertical line formed as a2 sweeps from -1 to 1.

So we can get a clean graphic by plotting the bottom boundary by fixing a2 == -1, extracting the points, and adding the upper left corner to form a polygon.

bdplot = With[{a2 = -1},
ParametricPlot[{1 + a1/(-1 + a2), 1 - 2 ArcCsc[2/Sqrt[1 + a1 - a2]]/π}, {a1, -2, 2},
Frame -> True, PlotRange -> {{0, 2}, {0, 1}}, AspectRatio -> 1/GoldenRatio] // Quiet
]


pts = Append[MeshCoordinates[DiscretizeGraphics[bdplot]], {0, 1}];

poly = Polygon[FindShortestTour[pts][[2, 1 ;; -2]]];

Graphics[GraphicsComplex[pts, {EdgeForm[], Hue[0.6, 0.3, 0.95], poly}], Frame -> True, AspectRatio -> 1/GoldenRatio]


Now notice that your constraint is not needed:

Reduce[a2 >= -1 && 1 + a1 >= a2 && a1 + a2 <= 1, a1]

(-1 <= a2 < 1 && -1 + a2 <= a1 <= 1 - a2) || (a2 == 1 && a1 == 0)


We see the constraint says a1 should range from -1 + a2 to 1 - a2 instead of -2 to 2. If we plot for many fixed values of a2, we see we'd have the same plot if all a2 were sampled:

Show@Table[
ParametricPlot[{1 + a1/(-1 + a2), 1 - 2 ArcCsc[2/Sqrt[1 + a1 - a2]]/π}, {a1, -1 + a2, 1 - a2},
Frame -> True, PlotRange -> {{0, 2}, {0, 1}}, AspectRatio -> 1/GoldenRatio, PlotPoints -> 100] // Quiet,
{a2, Range[-1, 1, .01] /. {-1. -> -0.999, 1. -> 0.999}}
]


• Exactly the approach I've just undertaken :o Although I've made a few tweaks. Will post in a moment. – corey979 Sep 28 '19 at 14:12
• The lower boundray isn't th problem I think. The upper boundary, especially the point a1==2&&a2==1 has to be examined in more detail. – Ulrich Neumann Sep 29 '19 at 5:57

As discussed by Chip Hurst, the lower boundary of the region can be obtained by setting a2=-1. Therefore, this boundary is parametrized by a1 only (let it be called $$(A,T)$$):

reg = With[{a2 = -1}, {1 + a1/(-1 + a2), 1 - 2 ArcCsc[2/Sqrt[1 + a1 - a2]]/\[Pi]}]


{1 - a1/2, 1 - (2 ArcCsc[2/Sqrt[2 + a1]])/[Pi]}

This can be solved to get a1 as a function of A:

sol = Solve[A == reg[[1]], a1][[1]]


{a1 -> -2 (-1 + A)}

and inserted into T to obtain a function $$T(A)$$, Then the plotting is done with Filling:

Plot[reg[[2]] /. sol, {A, 0, 2}, Frame -> True, Filling -> Top, PlotStyle -> None]


The region can then be describe with e.g. ImplicitRegion.

Try option RegionFunction inside ParametricPlot together with the Option MaxRecursions.

The second plot argument 1 - 2 ArcCsc[2/Sqrt[1 + a1 - a2]]/\[Pi] is only defined for 1 + a1 >= a2, that's why I only consider this restriction!

ParametricPlot[ {1 + a1/(-1 + a2) ,1 - 2 ArcCsc[2/Sqrt[1 + a1 - a2]]/\[Pi] }, {a1, -2, 2}, {a2, -1, 1},Frame -> True, PlotRange -> {{0, 2 }, {0, 1}} ,AspectRatio -> 1/GoldenRatio, Evaluated -> True, MaxRecursion -> 4,PlotPoints->50, FrameLabel -> {a1, a2},RegionFunction -> Function[{x,y,a1, a2},   -a1 + a2 <= 1  ]]


• With {a1, -2, 2}, {a2, -1, 1} and PlotRange -> {{0, 2}, {0, 1}}, the proper ranges I'm interested in, this plots a different Region than appears in my OP. And fyi, it's not (a1,a2) on the axes, but some functions of them. – corey979 Sep 28 '19 at 12:37
• The scaling of the plotrange shouldn't be a problem I think. I modified my answer! – Ulrich Neumann Sep 28 '19 at 12:42
• I think your RegionFunction arg spec should be Function[{x, y, a1, a2}, ...]. – Chip Hurst Sep 28 '19 at 13:20
• @ChipHurst Thanks, I changed my answer! – Ulrich Neumann Sep 29 '19 at 5:54