10
$\begingroup$

I have:

Show[
 ParametricPlot3D[r[t], {t, 0, 2 π},
   PlotStyle -> {Blue, Thick, Arrowheads[0.04]},
   AxesLabel -> {"x", "y", "z"}] /. Line -> Arrow,
 ParametricPlot3D[r[t], {t, 0, π/2},
  PlotStyle -> {Red, Thickness[0.02]},
  AxesLabel -> {"x", "y", "z"}],
 Graphics3D[{
   Red, PointSize[Large], Point[{r[0], r[π/2]}],
   Text[Style["(1,0,0) at time 0", Black, 12, Background -> White], 
    r[0], {-1.5, 0}],
   Text[Style["(x(t), y(t), z(t)) at time t", Black, 12, Background -> White], 
    r[π/2], {-1.5, 0}]
   }]
 ]

Which produces this image:

enter image description here

Note that the first curve, drawn in blue, shows through the second curve, drawn in red. I tried increasing the thickness, but that didn't help. I'd like to prevent the blue from shining through. Any suggestions?

Update due to Comment Help:

I'd like to thank everyone for their help on my question. Here is my final proposal.

DynamicModule[{r},
 r[t_] = {Cos[t], Sin[t], t};
 Manipulate[Show[
   ParametricPlot3D[r[t], {t, 0, 2 \[Pi]},
     Mesh -> {{t0}}, MeshShading -> {Red, Blue},
     MeshStyle -> {Red, PointSize[Large]},
     PlotStyle -> {{Thick, Arrowheads[0.04]}},
     AxesLabel -> {"x", "y", "z"}] /. 
    g : {___, Blue, ___} :> (g /. Line -> Arrow), Graphics3D[{
     {Red, PointSize[Large], Point[r[0]]}, 
     Text[Style["(1,0,0) at time 0", Black, 12, Background -> White], 
      r[0], {-1.5, 0}], 
     If[t0 > 0.1, 
      Text[Style["(x(t), y(t), z(t)) at time t", Black, 12, 
        Background -> White], r[t0], {-1.5, 0}], {}]
     }], ImagePadding -> {{Automatic, 120}, {Automatic, Automatic}}
   ],
  {t0, 0.05, 2. Pi - 0.05}]
 ]

Which produces this image after I move the point a bit.

enter image description here

However, I am writing large notebooks, each explaining a section of our calculus book, so there might be several Manipulate codings. MichaelE2, you might remember helping to make sure that code in one manipulate doesn't interfere with something in another manipulate (Continuation of a Problem with Manipulate). So, does what I've written above (DynamicModule) seem OK to you?

$\endgroup$
  • $\begingroup$ You can try making the replacement Line[pts_] :> Tube[pts, 0.08] in the second ParametricPlot3D[]. $\endgroup$ – J. M.'s discontentment Jun 13 '15 at 6:59
  • $\begingroup$ @Guesswhoitis.I was trying exactly that. But there are some quirks !Mathematica graphics $\endgroup$ – Dr. belisarius Jun 13 '15 at 7:03
4
$\begingroup$

Another way using MeshShading:

Clear[r, t];
r[t_] = {Cos[t], Sin[t], t/2};

Manipulate[
 Show[
  ParametricPlot3D[r[t], {t, 0, 2 \[Pi]},
    Mesh -> {{t0}}, MeshShading -> {Red, Blue}, 
    MeshStyle -> {Red, PointSize[Large]}, 
    PlotStyle -> {Thick, Arrowheads[0.04]}, 
    AxesLabel -> {"x", "y", "z"}] /. 
   g : {___, Blue, ___} :> (g /. Line -> Arrow), 
  Graphics3D[{Text[
     Style["(1,0,0) at time 0", Black, 12, Background -> White], 
     r[0], {-1.5, 0}],
    If[t0 > 0.1,
     Text[
      Style["(x(t), y(t), z(t)) at time t", Black, 12, 
       Background -> White], r[t0], {-1.5, 0}],
     {}]}],
  ImagePadding -> {{Automatic, 120}, {Automatic, Automatic}}],
 {t0, 0.05, 2. Pi - 0.05}
 ]

Mathematica graphics

| improve this answer | |
$\endgroup$
  • $\begingroup$ I learned a lot again from this answer. I've made an update to my original post above with a reminder of your help when using several Manipulates in a single notebook. So, first question is, does it look OK to you? My second question regards PlotStyle -> {{Thick, Arrowheads[0.04], Arrow @@@ {##}} &}. I looked up @@@ and it's Apply, and I looked up ## and it represents the complete sequence of arguments supplied to a pure function, but I tried deleting Arrows @@@ {##} and it made no difference, so I am not quite understanding this part. Again, thanks for marvelous help. $\endgroup$ – David Jun 13 '15 at 20:06
  • $\begingroup$ @David Oops, I was trying something that works with ParametricPlot, which doesn't seem to work with ParametricPlot3D. I meant to take it out (which I have now done). $\endgroup$ – Michael E2 Jun 14 '15 at 15:43
9
$\begingroup$

Assuming that you have used the parametrization $$r(t)=(\cos{t},\sin{t},t).$$ You could just make the interval over which you plot the blue line shorter, from $[0,2\pi]$ to $[\frac{1}{2}\pi,2\pi]$, so that the plots don't overlap. Then you would get something like this:

Show[
  ParametricPlot3D[r[t], {t, π/2, 2 π}, 
    PlotStyle -> {Blue, Thick, Arrowheads[0.04]}, 
    AxesLabel -> {"x", "y", "z"}] /. Line -> Arrow, 
  ParametricPlot3D[r[t], {t, 0, π/2}, 
    PlotStyle -> {Red, Thick}, 
    AxesLabel -> {"x", "y", "z"}], 
  Graphics3D[{
    Red, PointSize[Large], Point[{r[0], r[π/2]}], 
    Text[Style["(1,0,0) at time 0", Black, 12, Background -> White], 
      r[0], {-1.5, 0}], 
    Text[Style["(1,0,0) at time t", Black, 12, Background -> White], 
      r[π/2], {-1.5, 0}]}], 
  PlotRange -> All]

which results in

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks, this is fine for a static image, but I may want to continue and make it a Manipulate demonstration. $\endgroup$ – David Jun 13 '15 at 15:53
  • 1
    $\begingroup$ @David I see. Would something like this be good enough? Manipulate[ Show[ParametricPlot3D[r[t], {t, a, 2 [Pi]}, PlotStyle -> Blue], ParametricPlot3D[r[t], {t, 0, a}, PlotStyle -> Red], PlotRange -> All], {a, Pi/2, 3 Pi/2}] $\endgroup$ – Pjotr5 Jun 13 '15 at 17:17
  • $\begingroup$ Yep, that would work, thanks for your effort. $\endgroup$ – David Jun 13 '15 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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