# Can this short code be written in terms of ParametricPlot?

I'm studying the following short code in an answer:

dphi = Pi/30; (* angle *)
rend = 0.99; (* radius *)
pts = Table[
r*Exp[I N[phi, 30]], {phi, -Pi + dphi/2, Pi - dphi/2, dphi},
{r, 0, rend, rend/10}]; (* a table of points in the polar coordinate grid*)

toColor[z_] := List @@ ColorConvert[Hue[Arg[N[z]]/(2 Pi)], "RGB"]
(* generate colors *)

line[pts_] := line[pts, Identity]; (* define a function using the next one*)

line[pts_, func_] := Line[ReIm[func[pts]], VertexColors -> (toColor /@ pts)]
Graphics[{line /@ pts, line /@ Transpose[pts]}]


I can trace line by line to see how the functions Line[] and Graphics[] work. It looks not very natural and very smart to me.

Can this be translated to a version using ParametricPlot instead?

• ParametricPlot[] does not have the ability to color mesh lines with a function instead of a solid color. If you're willing to sacrifice that, then yes, this is doable with ParametricPlot[]. Sep 19, 2017 at 0:22
• If you really want to use ParametricPlot[], you need to do some work: Show[Table[ParametricPlot[ReIm[r Exp[I t]], {r, 0, rend}, ColorFunction -> Function[{x, y}, Hue[Arg[x + I y]/(2 Pi)]], ColorFunctionScaling -> False], {t, -Pi + dphi/2, Pi - dphi/2, dphi}], Table[ParametricPlot[ReIm[r Exp[I t]], {t, -Pi + dphi/2, Pi - dphi/2}, ColorFunction -> Function[{x, y}, Hue[Arg[x + I y]/(2 Pi)]], ColorFunctionScaling -> False], {r, 0, rend, rend/10}], Axes -> None, PlotRange -> All] Sep 19, 2017 at 0:30
• @J.M. many thanks.
– user664
Sep 19, 2017 at 0:40
– user664
Sep 19, 2017 at 1:37
• The code in the second one is a hack; that is, I generate curves individually and use Show[] to bring them all together at the end. So, the two comments are definitely consistent. It's not doable with a single convenient ParametricPlot[], but you can do it with a little work. Sep 19, 2017 at 5:22

Thanks to @J.M.'s comment, I learned that ParametricPlot alone would not work. One can however do the following:

dphi = Pi/30; rend = 0.99; pts =
Table[r*Exp[I N[phi, 30]], {phi, -Pi + dphi/2, Pi - dphi/2,
dphi}, {r, 0, rend, rend/10}];
Show[
Table[ParametricPlot[ReIm[r Exp[I t]], {r, 0, rend},
ColorFunction -> Function[{x, y}, Hue[Arg[x + I y]/(2 Pi)]],
ColorFunctionScaling -> False], {t, -Pi + dphi/2, Pi - dphi/2,
dphi}], Table[
ParametricPlot[ReIm[r Exp[I t]], {t, -Pi + dphi/2, Pi - dphi/2},
ColorFunction -> Function[{x, y}, Hue[Arg[x + I y]/(2 Pi)]],
ColorFunctionScaling -> False], {r, 0, rend, rend/10}],
Axes -> None, PlotRange -> All]