I have two surfaces $f_1(x,y)$ and $f_2(x,y)$. I want to plot the isolines of $f_2$, i.e. the points such that $f_2(x,y)=C$ with $C$ a constant, on the surface 3D plot of $f_1(x,y)$.

A similar problem is here solved with density plots, but I want a 3D plot.

  • $\begingroup$ Please post your two functions. $\endgroup$
    – cvgmt
    Feb 24, 2022 at 8:01

1 Answer 1


You can use the options MeshFunctions and Mesh with Plot3D as follows:

ClearAll[f1, f2]
f1[x_, y_] := Sin[x + y^2]
f2[x_, y_] := (x^2 + y) Cos[x^2 + 2 y]

c = .5;

Plot3D[f1[x, y], {x, -3, 3}, {y, -2, 2}, 
 MeshFunctions -> {f2[#, #2] &},
 Mesh -> {{c}}, 
 MeshStyle -> Directive[Thick, Blue]]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.