# Plotting a parametric function on xy, xz, and yz planes

I'm trying to plot a trefoil with a parametric function in Mathematica. How would I do that? I know I can use Parametric3D to depict all of it but how do I project it on the XY, XZ, and YZ planes?

It's function is $$r(t)= ((1+\cos(3t))\cos(t),(1+\cos(3t)\sin(t), \sin(3t)$$.

Thank you.

• It's ParametricPlot3D not Parametric3D. Consult the documentation. For the planes, just do three plots and set z to 0, y to 0, and x to zero and wrap in a Show like Show[ParametricPlot3D[...], ParametricPlot3D[...], ParametricPlot3D[...], ParametricPlot3D[...]] May 18, 2021 at 18:16
• Thank you! This was very helpful! May 18, 2021 at 18:27
• related/possible duplicate: How to project 3d image in the planes xy, xz, yz?
– kglr
May 18, 2021 at 21:17

Clear["Global*"]

r[t_] = {(1 + Cos[3 t]) Cos[t], (1 + Cos[3 t]) Sin[t], Sin[3 t]};

ParametricPlot3D[{r[t],
ReplacePart[r[t], 1 -> -1.75],
ReplacePart[r[t], 2 -> 2.5],
ReplacePart[r[t], 3 -> -1.5]},
{t, 0, 2 Pi},
AxesLabel ->
(Style[#, 14, Bold] & /@ {x, y, z}),
PlotLegends -> {"r(t)", "YZ", "XZ", "XY"}]


EDIT: To see the progression of the parameter

ParametricPlot3D[{r[t],
ReplacePart[r[t], 1 -> -1.75],
ReplacePart[r[t], 2 -> 2.5],
ReplacePart[r[t], 3 -> -1.5]},
{t, 0, 2 Pi},
AxesLabel -> (Style[#, 14, Bold] & /@ {x, y, z}),
PlotLegends -> BarLegend[{"Rainbow", {0, 2 Pi}},
LegendLabel -> Style[t, 14, Bold]],
ColorFunction -> Function[{x, y, z, t},
ColorData["Rainbow"][t]]]


ScalingTransform[{1,1,0}] is the project transformation to X-Y plane etc.

r[t_] := {Cos[t] (1 + Cos[3 t]), (1 + Cos[3 t]) Sin[t],
Sin[3 t]};
Show[
ParametricPlot3D[
Through@(ScalingTransform /@ {{1, 1, 1}, {1, 1, 0}, {1, 0, 1}, {0,
1, 1}})@r[t] // Evaluate, {t, 0, 2 π},
PlotStyle -> {Directive[AbsoluteThickness[3], Red],
Directive[Dashed, Green], Directive[Dashed, Cyan],
Directive[Dashed, Yellow]}, Boxed -> False, Axes -> False],
Graphics3D[{InfinitePlane[{0, 0, 0}, {{1, 0, 0}, {0, 1, 0}}],
InfinitePlane[{0, 0, 0}, {{0, 1, 0}, {0, 0, 1}}],
InfinitePlane[{0, 0, 0}, {{0, 0, 1}, {1, 0, 0}}]}]]
`