Function Repository Resource:

DirectionParametricPlot3D

Source Notebook

Create a parametric plot of a curve in space with direction indicated by arrowheads and color

Contributed by: Dennis M Schneider

ResourceFunction["DirectionParametricPlot3D"][{fx,fy,fz},{t,tmin,tmax}]

generates a parametric plot of a curve {fx,fy,fz} in space whose coordinate functions are functions of t with the direction of the curve indicated by color and arrowheads.

Details and Options

The following options are supported:
"ArrowNumber"15number of arrowheads to include in the plot
"ArrowSize"Largesize of the arrowheads
ColorFunctionAutomaticspecify the color function
"DrawArrowheads"Truewhether to include the arrowheads in the plot
PlotStyleAutomaticstyle to be applied to the curve

Examples

Basic Examples (1) 

A conical helix climbing up the z-axis:

In[1]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{t Cos[4 \[Pi] t], t Sin[4 \[Pi] t], t}, {t, 0, 2}]
Out[1]=

Options (11) 

ArrowSize (2) 

The option "ArrowSize"1 corresponds (roughly) to the default "ArrowSize"Large:

In[2]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{t Cos[4 \[Pi] t], t Sin[4 \[Pi] t], t}, {t, 0, 2}, "ArrowSize" -> 1]
Out[2]=

Make the arrowheads smaller:

In[3]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{Cos[t] Cos[10 t], Cos[t] Sin[10 t], t}, {t, 0, \[Pi]}, "ArrowSize" -> Medium]
Out[3]=

ArrowNumber (2) 

Plot more arrowheads:

In[4]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{Cos[t] Cos[10 t], Cos[t] Sin[10 t], t}, {t, 0, \[Pi]}, "ArrowNumber" -> 25]
Out[4]=

Suppress the arrowheads by setting "ArrowNumber" to 0:

In[5]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{Cos[t] Cos[10 t], Cos[t] Sin[10 t], t}, {t, 0, \[Pi]}, "ArrowNumber" -> 0]
Out[5]=

DrawArrowheads (1) 

Suppress the arrowheads by setting "DrawArrowheads"False:

In[6]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{Cos[t] Cos[10 t], Cos[t] Sin[10 t], t}, {t, 0, \[Pi]}, "DrawArrowheads" -> False]
Out[6]=

PlotStyle (4) 

Setting PlotStyle to a color plots the curve in that color:

In[7]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{Cos[t] Cos[10 t], Cos[t] Sin[10 t], t}, {t, 0, \[Pi]}, PlotStyle -> Purple]
Out[7]=

Plot two curves with a different style as well as a different size arrowhead for each curve:

In[8]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{{2 Cos[5 t], 2 Sin[5 t], t}, {Cos[t] Cos[10 t], Cos[t] Sin[10 t], t}}, {t, 0, \[Pi]}, PlotStyle -> {Thickness[.007], Thickness[.013]}, "ArrowSize" -> {Medium, Large}]
Out[8]=

Non-color-related values for PlotStyle will not affect the automatic coloring:

In[9]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{Cos[t] Cos[10 t], Cos[t] Sin[10 t], t}, {t, 0, \[Pi]}, PlotStyle -> Thickness[.013]]
Out[9]=

For multiple curves, if just one style is specified, it is applied to both curves:

In[10]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{{2 Cos[5 t], 2 Sin[5 t], t}, {Cos[t] Cos[10 t], Cos[t] Sin[10 t], t}}, {t, 0, \[Pi]}, PlotStyle -> Thickness[.013]]
Out[10]=

ColorFunction (1) 

Change the color function:

In[11]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{Cos[t] Cos[10 t], Cos[t] Sin[10 t], t}, {t, 0, \[Pi]}, ColorFunction -> Function[{x, y, z, t}, GrayLevel[.8 t]]]
Out[11]=

PlotLegends (1) 

Since PlotLegends depends on the color of the curve, they will not work unless ColorFunction is set to None or the specifications for PlotStyle contain a color:

In[12]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{{3/2 Cos[3 \[Pi] t], 3/2 Sin[3 \[Pi] t], 2 t}, {2 t Cos[3 \[Pi] t], 2 t Sin[3 \[Pi] t], 2 t}}, {t, 0, 2}, ColorFunction -> None, PlotLegends -> "Expressions"]
Out[12]=
In[13]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{{3/2 Cos[3 \[Pi] t], 3/2 Sin[3 \[Pi] t], 2 t}, {2 t Cos[3 \[Pi] t], 2 t Sin[3 \[Pi] t], 2 t}}, {t, 0, 2}, PlotStyle -> {Thickness[.01], {Magenta, Thickness[.013]}}, PlotLegends -> "Expressions"]
Out[13]=

Properties and Relations (2) 

Without DirectionParametricPlot3D, it is difficult to tell how the curve is traced out:

In[14]:=
ParametricPlot3D[{Sin[t] Cos[2 t], 2 Sin[t] Cos[t], Sin[2 t]}, {t, 0, 2 \[Pi]}]
Out[14]=

Using DirectionParametricPlot3D, it is easy to see how the curve is traced out:

In[15]:=
ResourceFunction[
 "DirectionParametricPlot3D"][{Sin[t] Cos[2 t], 2 Sin[t] Cos[t], Sin[2 t]}, {t, 0, 2 \[Pi]}]
Out[15]=

Publisher

Dennis M Schneider

Version History

  • 1.0.0 – 13 September 2019

Related Resources

License Information