# How to create angled or parabolic cross-section through 3d plot

I'm trying to create cross-sections through a 3d plot, but I want my cross sections to be a function of the x and y axes. For example:

Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},
AxesLabel -> {"x", "y", "z"}, MeshFunctions -> {#1 &}, Mesh -> 5,
MeshStyle -> Directive[Red, Thick], PlotStyle -> Opacity[.5]]


This plots cross sections in the x direction only, and {#2 &} would plot in the y direction. How can I change the Mesh so that it that each line of Mesh corresponds to the relationship y=x^2, or y=2x for instance.

I tried this with MeshFunction but can't seem to get the cross sections running in the correct z plane.

• ... MeshFunctions -> {#^2 - #2 &}, Mesh -> {{0}} ...? – Kuba Jan 5 '18 at 6:53

## 1 Answer

Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},
AxesLabel -> {"x", "y", "z"},
MeshFunctions -> {#1 #1 - #2 &, 2 #1 - #2 &}, Mesh -> {{0}, {0}},
MeshStyle -> {Directive[Red, Thick], Directive[Green, Thick]},
PlotStyle -> Opacity[.5]]


• Thanks that works perfectly! – supagr8 Jan 5 '18 at 17:11
• @supagr8 I had not seen Kuba comment. You can modify using his comment to make succinct. – ubpdqn Jan 5 '18 at 22:12