How can I plot Plot3D[{1/(2 Sqrt[2] x y)}, {x, 0, 1}, {y, 0, 1}]
such that the only portion gets plotted for which $x^2 + y^2 =1$?
2 Answers
Use MeshFunctions
x^2+y^2
and set Mesh
to {{1}}
.
Plot3D[1/(2 Sqrt[2] x y), {x, 0, 1}, {y, 0, 1},
AxesLabel -> {x, y, z}, MeshFunctions -> Function[{x, y}, x^2 + y^2],
Mesh -> {{1}}, MeshStyle -> {Thick, Red}, PlotStyle -> None,
ClippingStyle -> None, BoundaryStyle -> None]
workaround RegionFunction
( see @flinty's comment )
Plot3D[{1/(2 Sqrt[2] x y)}, {x, 0, 1}, {y, 0, 1},
RegionFunction -> Function[{x, y },
Evaluate[ grad = Grad[ x^2 + y^2 - 1, {x, y }]; -.02 Sqrt[grad . grad ] <= x^2 + y^2 - 1 <= .02 Sqrt[grad . grad ] ]]
, Mesh -> False , ClippingStyle -> None , BoundaryStyle -> None ]
RegionFunction
like thisPlot3D[{1/(2 Sqrt[2] x y)}, {x, 0, 1}, {y, 0, 1}, RegionFunction -> Function[{x, y, z}, x^2 + y^2 <= 1]]
. Bear in mind I've used $\leq1$ not $=1$ because $=1$ would produce a line too thin to show up on aPlot3D
. If you want this, you're better off using a parametric plot. $\endgroup$ParametricPlot3D[{x, y, 1/(2 Sqrt[2] x y)} /. {x -> Cos[θ], y -> Sin[θ]}, {θ, 0, 2 π}, BoxRatios -> 1]
$\endgroup${θ, 0, π/2}
$\endgroup$