3
$\begingroup$

I have been trying to add an arrow head at the end (o even at some point) of a very simple parametric.

ParametricPlot3D[{-5 Sin[3 t], 5 Cos[3 t], t}, {t, 0, 15}]

But can not find a simple way to do it.

I have tried to merge plots using Show[plot1,arrowh] (for example), but this is not that elegant nor functional.

Any ideas?

$\endgroup$
2
  • 1
    $\begingroup$ See this. $\endgroup$ Commented Jul 9, 2020 at 18:35
  • $\begingroup$ @RohitNamjoshi now that I understand it, yes, I did checked that question/answer before posting but didn't quite understood it. $\endgroup$ Commented Jul 9, 2020 at 19:09

1 Answer 1

5
$\begingroup$

ParametricPlot3D creates a Line which we can replace by an Arrow:

pl = ParametricPlot3D[{-5 Sin[3 t], 5 Cos[3 t], t}, {t, 0, 15}];
pl /. Line -> Arrow

Output

This will place arrowheads at fractions 0.1, 0.4, 0.7 and 1 along the curve:

arrowheads = Arrowheads@Transpose[{
     ConstantArray[Large, 4],
     {0.1, 0.4, 0.7, 1}
     }];
pl /. Line[pts_] :> {arrowheads, Arrow[pts]}

Output

$\endgroup$
7
  • $\begingroup$ Perfect, just to deepen a bit, could you add multiple arrows of move it along the curve? $\endgroup$ Commented Jul 9, 2020 at 18:30
  • $\begingroup$ See this. $\endgroup$ Commented Jul 9, 2020 at 18:37
  • $\begingroup$ @C.Alexander As Rohit is showing it's really all about Arrowheads, but I added an example here as well. $\endgroup$
    – C. E.
    Commented Jul 9, 2020 at 18:40
  • 1
    $\begingroup$ You can also Partition the Line, e.g., ParametricPlot3D[{-5 Sin[3 t], 5 Cos[3 t], t}, {t, 0, 15}] /. Line[pts__] :> Arrow /@ Partition[pts, 50, 49] $\endgroup$
    – Bob Hanlon
    Commented Jul 9, 2020 at 19:04
  • 1
    $\begingroup$ Or reverse the points: ParametricPlot3D[{-5 Sin[3 t], 5 Cos[3 t], t}, {t, 0, 15}] /. Line[pts__] :> Arrow /@ Partition[Reverse@pts, 50, 49] $\endgroup$
    – Bob Hanlon
    Commented Jul 9, 2020 at 20:26

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