5
$\begingroup$

This code visualize a complex map, but it looks rather cumbersome:

F[z_] := z^2;
t1 = 0; 
t2 = Pi/3;
r1 = 1;
r2 = 3;
dt = (t2 - t1)/10;
dr = (r2 - r1)/10;

p1 = Show[
  Table[ParametricPlot[ReIm[r Exp[I t]], {r, r1, r2}], {t, t1, t2, 
    dt}],
  Table[ParametricPlot[ReIm[r Exp[I t]], {t, t1, t2}], {r, r1, r2, 
    dr}],
  ParametricPlot[ReIm[r Exp[I 4 dt]], {r, r1 + 5 dr, r1 + 6 dr}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[ReIm[r Exp[I 5 dt]], {r, r1 + 5 dr, r1 + 6 dr}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[ReIm[r Exp[I 6 dt]], {r, r1 + 6 dr, r1 + 7 dr}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[ReIm[r Exp[I 3 dt]], {r, r1 + 6 dr, r1 + 7 dr}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[
   ReIm[(r1 + 7 dr) Exp[I t]], {t, t1 + 3 dt, t1 + 6 dt}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[
   ReIm[(r1 + 6 dr) Exp[I t]], {t, t1 + 3 dt, t1 + 4 dt}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[
   ReIm[(r1 + 6 dr) Exp[I t]], {t, t1 + 5 dt, t1 + 6 dt}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[
   ReIm[(r1 + 5 dr) Exp[I t]], {t, t1 + 4 dt, t1 + 5 dt}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  Axes -> None, PlotRange -> All]

p2 = Show[
  Table[ParametricPlot[ReIm[F[r Exp[I t]]], {t, t1, t2}], {r, r1, r2, 
    dr}],
  Table[ParametricPlot[ReIm[F[r Exp[I t]]], {r, r1, r2}], {t, t1, t2, 
    dt}],
  ParametricPlot[ReIm[(r Exp[I 4 dt])^2], {r, r1 + 5 dr, r1 + 6 dr}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[ReIm[(r Exp[I 5 dt])^2], {r, r1 + 5 dr, r1 + 6 dr}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[ReIm[(r Exp[I 6 dt])^2], {r, r1 + 6 dr, r1 + 7 dr}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[ReIm[(r Exp[I 3 dt])^2], {r, r1 + 6 dr, r1 + 7 dr}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[
   ReIm[((r1 + 7 dr) Exp[I t])^2], {t, t1 + 3 dt, t1 + 6 dt}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[
   ReIm[((r1 + 6 dr) Exp[I t])^2], {t, t1 + 3 dt, t1 + 4 dt}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[
   ReIm[((r1 + 6 dr) Exp[I t])^2], {t, t1 + 5 dt, t1 + 6 dt}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ParametricPlot[
   ReIm[((r1 + 5 dr) Exp[I t])^2], {t, t1 + 4 dt, t1 + 5 dt}, 
   PlotStyle -> {Black, Thickness[0.01]}],
  ImageSize -> 200,
  Axes -> None,
  PlotRange -> All]

enter image description here enter image description here

I'm wondering if there is a way to make it significantly shorter since there are lots of repeating functions used.

$\endgroup$

2 Answers 2

10
$\begingroup$

You can get filled in grid sectors fairly easily with MeshShading:

GraphicsRow[
 With[{z = r Exp[I t], col = Black},
    ParametricPlot[ReIm@#[z], {r, r1, r2}, {t, t1, t2}, Mesh -> 9,
     MeshShading -> 
      ArrayPad[{{None, col}, {col, col}, {None, col}}, {{3, 4}, {5, 
         3}}, None], Frame -> False, AxesOrigin -> {0, 0}
     ]
    ] & /@ {Identity, F}
 ]

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ I didn't expect that it could be this simple. Thanks Michael! I think this should be accepted as an answer to another related question: mathematica.stackexchange.com/q/156339/664. Do you have a simplification of my code in a way that the T shape would be the same as the one showed in this question? $\endgroup$
    – user664
    Commented Sep 23, 2017 at 14:23
  • $\begingroup$ @Jack, the only reason why the code for your other question was complicated was that you wanted coloring. Without coloring, it is indeed as easy as Michael has shown. $\endgroup$ Commented Sep 23, 2017 at 16:54
2
$\begingroup$

At least, the generation of the mesh can be shortened to

t1 = 0;
t2 = Pi/3;
r1 = 1;
r2 = 3;
ParametricPlot[ReIm[r Exp[I t]], {r, r1, r2}, {t, t1, t2}, 
 Mesh -> {10, 10},
 PlotStyle -> {FaceForm[]},
 MeshStyle -> {{Opacity[.5], ColorData[97][1]}},
 BoundaryStyle -> {{Opacity[.5], ColorData[97][1]}}
 ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.