I want to plot some wavefronts in Mathematica, and I'm having some trouble reining in one of the options for my ContourPlot3D.
More specifically, the documentation for ContourPlot3D
says that the Contours
option can be used in the form
ContourPlot3D[
x^3 + y^2 - z^2
, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}
, Contours -> {{-2, Red}, {2, Blue}}
, Mesh -> None
]
to produce contours at those levels and with those colours, but when I try to implement that I get some pretty wonky behaviour. As a minimal example, consider the following plane wave:
L = π + 0.001;
ContourPlot3D[
Arg[Exp[I z]]
, {x, -L, L}, {y, -L, L}, {z, -L, L}
, Contours -> Table[{ϕ, Hue[(ϕ + π)/(2 π)]}, {ϕ, -π, π, π/3}]
, Mesh -> None
]
Unfortunately, it produces some pretty paltry output,
with a bunch of contours missing. Weirdly enough, these contours do appear if I give it numerical values for the contours:
ContourPlot3D[
Arg[Exp[I z]]
, {x, -L, L}, {y, -L, L}, {z, -L, L}
, Contours -> Table[{N[ϕ], Hue[(ϕ + π)/(2 π)]}, {ϕ, -π, π, π/3}]
, Mesh -> None
]
What's going on here? Is this a bug?
Hue
):ContourPlot3D[Arg[Exp[I z]], {x, -L, L}, {y, -L, L}, {z, -L, L}, Contours -> Table[\[Phi], {\[Phi], -\[Pi], \[Pi], \[Pi]/3}], Mesh -> None]
$\endgroup$ – Michael E2 Jul 21 '16 at 19:44{z, -L ,L}
and jumps over several contours near±L
. That's probably confusing the mesher. $\endgroup$ – Michael E2 Jul 21 '16 at 19:52Contours -> {N@\[Pi]/3}
works fine. $\endgroup$ – Michael E2 Jul 21 '16 at 19:53{val,_color}
or to theArg
function. Compare the output ofContourPlot3D[z, {x, -1, 1}, {y, -1, 1}, {z, 0, 5}, Contours -> N /@ {\[Pi], E, EulerGamma}]
toContourPlot3D[z, {x, -1, 1}, {y, -1, 1}, {z, 0, 5}, Contours -> {\[Pi], E, EulerGamma}]
$\endgroup$ – Jason B. Jul 21 '16 at 19:53