5
$\begingroup$

Before I add /. Line -> Arrow, I had a continuous plot by using Joined -> True command. Why there is a small gap at the tip of the arrow now? What did I do wrong?

n=100;
Do[
ss[j] = N[2 Pi (j - 1)/n];
rr[j] = N[Sqrt[1 + (Cos[4 ss[j]])^2]];  
    ETA[j] = N[rr[j] Exp[I ss[j]]];
      fA[j] = N[Exp[rr[j]]],
{j, 1, n + 1}]

Shape = ListPlot[Table[{Re[ETA[j]], Im[ETA[j]]}, {j, n + 1}], 
Joined -> True, PlotStyle -> {Black, Thick}, 
AspectRatio -> Automatic, PlotRange -> {{-2, 2}, {-2, 2}}, 
Axes -> False, Frame -> {{True, False}, {True, False}}, 
FrameTicks -> {{{-2, -1, 0, 1, 2}, None}, {{-2, -1, 0, 1, 2}, 
   None}},
FrameLabel -> {Re t, Im t}, RotateLabel -> False, 
FrameStyle -> Directive[FontSize -> 24]] /. Line -> Arrow;

enter image description here

$\endgroup$

3 Answers 3

6
$\begingroup$

Partially for the sake of answering the question in a way close the the way OP is doing, but also to clean up the code a little bit:

First of all, using Do is overkill. Instead, do

Clear[rr, ss, ETA, fA, n];
n = 100;
ss[j_] = N[2 Pi (j - 1)/n];
rr[j_] = N[Sqrt[1 + (Cos[4 ss[j]])^2]];
ETA[j_] = rr[j] Exp[I ss[j]];

or even just

ETA[j_] = Sqrt[1 + (Cos[4 ss[j]])^2] Exp[I 2 Pi (j - 1)/n];

Then, use ParametricPlot (with some of the extraneous Options removed):

Shape = ParametricPlot[{Re[ETA[j]], Im[ETA[j]]}, {j, 1, n + 1},
          PlotStyle -> {Black, Thick}, 
          PlotRange -> {{-2, 2}, {-2, 2}},
          Axes -> False, Frame -> {{True, False}, {True, False}},
          FrameTicks -> {{{-2, -1, 0, 1, 2}, None}, {{-2, -1, 0, 1, 2}, None}},
          FrameLabel -> {"Re t", "Im t"}, 
          BaseStyle -> {FontSize -> 24}];

Finally, the way that I would fix this problem is to add an Arrowheads specification of the following form:

Shape /. Line[a_] :> {Arrowheads[{{0.06, 0.1}}], Arrow[a]}

This places the arrow about 10% along the curve, away from the end. It also allows you to put it in a more natural place (i.e. along a straight-ish section of the curve.

enter image description here

$\endgroup$
2
$\begingroup$

You can plot two figures on top of each other.

Shape = ListPlot[Table[{Re[ETA[j]], Im[ETA[j]]}, {j, n + 1}], Joined -> True, PlotStyle -> {Black, Thick}, AspectRatio -> Automatic, PlotRange -> {{-2, 2}, {-2, 2}}, Axes -> False, Frame -> {{True, False}, {True, False}}, FrameTicks -> {{{-2, -1, 0, 1, 2}, None}, {{-2, -1, 0, 1, 2}, None}}, FrameLabel -> {Re t, Im t}, RotateLabel -> False, FrameStyle -> Directive[FontSize -> 24]];
Show[{Shape, Shape /. Line -> Arrow}]

Mathematica graphics

$\endgroup$
2
$\begingroup$

There's nothing wrong, it's just the way Arrow objects are being plotted - a line ending with an Arrowhead, which causes this gap. If you don't want an arrow, but a line with an arrowhead at some point - you can simply add it on top of your plot with Epilog:

table = Table[{Re[ETA[j]], Im[ETA[j]]}, {j, n + 1}];

ListPlot[table, Joined -> True, AspectRatio -> Automatic,
  Epilog -> Arrow[table[[-3 ;; -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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.