# Plotting disk in 3D at given spherical angles [duplicate]

Edit: This question has very useful answers, but none address how to work with spherical coordinates.

I want to plot a 2D disk in 3D space, angled perpendicular to a given direction. That direction is given by $\theta$ and $\phi$ in spherical coordinates (where $\theta$ is polar and $\phi$ is azimuthal cause I'm a physicist, sorry math people!).

Here's four approaches I've tried that nearly work but not quite:

1. ContourPlot3D in cartesian coordinates

ContourPlot3D[{x + y + z == 1}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]


This gives an inclined plane, but I can't figure out how to put it at the desired angles $\theta$ and $\phi$. I also wouldn't know how to make this a disk with a finite radius.

2. ContourPlot3D in spherical coordinates, by converting x+y+z==1 into spherical

ContourPlot3D[{r*Sin[θ]*Cos[ϕ] + r*Sin[θ]*Sin[ϕ]
+ r*Cos[θ] == 1},
{r, 0, 1}, {θ, 0, Pi}, {ϕ, 0, 2*Pi}, AxesLabel -> Automatic]


This uses {r,$\theta$,$\phi$} as the plot coordinates, rather than plotting in proper cartesian space.

3. ParametricPlot3D to make a disk, then rotate it

ParametricPlot3D[{r*Sin[Pi/2]*Cos[ϕ],r*Sin[Pi/2]*Sin[ϕ], r*Cos[Pi/2]},
{r, 0, 1}, {ϕ, 0, 2*Pi},
PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, AxesLabel -> {x, y, z}]


This can produce a disk, but I can't figure out how to angle it. Here I set $\theta$=$\pi$/2 to make the disk.

4. Use Disk with Graphics3D and Rotate

This would work if Disk could be used as a 3D object! Argh!

That's all my ideas. If you see how to fix one of these, or have another, better idea, please advise!

## marked as duplicate by José Antonio Díaz Navas, Coolwater, Henrik Schumacher, LCarvalho, MarcoBMar 2 '18 at 3:21

First, define the normal in spherical coordinates:

n[theta_, phi_] := {Sin[theta]*Cos[phi], Sin[theta]*Sin[phi], Cos[theta]}


Then multiply your (syntax-corrected) ParametricPlot3D with RotationMatrix and wrap it in Manipulate:

Manipulate[
Show[
ParametricPlot3D[
RotationMatrix[{{0, 0, 1}, n[theta, phi]}].
{r*Sin[Pi/2]*Cos[Phi], r*Sin[Pi/2] Sin[Phi], r*Cos[Pi/2]}
, {r, 0, 1}, {Phi, 0, 2*Pi}
, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}
, AxesLabel -> {x, y, z}]
, Graphics3D[{Red, Arrow[{{0, 0, 0}, n[theta, phi]}]}]]
, {theta, 0, 2 Pi}, {phi, 0, Pi}]


• This is beautiful, thank you. RotationMatrix was the missing piece to my idea #3 above. Small note: typically theta goes 0->Pi and phi goes 0->2Pi. – Max Feb 17 '18 at 0:04

Given the normal vector

n={Cos[\[Theta]] Cos[\[CurlyPhi]], Cos[\[Theta]] Sin[\[CurlyPhi]],Sin[\[Theta]]}


the plane orthogonal to n is given by

e={Sin[\[CurlyPhi]], -Cos[\[CurlyPhi]], 0}
f={-Cos[\[CurlyPhi]] Sin[\[Theta]], -Sin[\[Theta]] Sin[\[CurlyPhi]],Cos[\[Theta]]}


The 3D-disk can be plotted using

Block[{\[Theta] = 50 \[Degree], \[CurlyPhi] = 10 \[Degree] },
Show[{Graphics3D[{Point[{0, 0, 0}], Opacity[.2], Sphere[]}],
ParametricPlot3D [r (Cos[t] e + Sin[t] f), {r, 0, 1}, {t, 0, 2 Pi}]}, Boxed-> False]
]


• Nothing wrong with you answer, but @anderstood built upon one of my solutions which made it easier for me to work with. Small feedback: aren't your n and e defined the same? – Max Feb 17 '18 at 0:10
• Sorry, cut &paste error: I edited my answer. – Ulrich Neumann Feb 17 '18 at 14:00
• ... n!=e: By the way I didn't agree, that using a RotationMatrix is easier than the evaluation of two orthogonal vectors... – Ulrich Neumann Feb 17 '18 at 14:07