# Visualizing the transformation from surface to contour plot in Windows

According to my understanding, this transformation from a surface in $$\mathbb{R}^3$$ to contour lines in $$\mathbb{R}^3$$ to a contour plot in $$\mathbb{R}^2$$ was made in Grapher, a program exclusive to Apple. Is there a way to view this type of transformation for a desired multivariable function in MATLAB, Python, or some free tool online or compatible with Windows? Is there also a way to view the inverse transformation from a contour plot in $$\mathbb{R}^2$$ to contour lines in $$\mathbb{R}^3$$ to a surface in $$\mathbb{R}^3$$ for such a user supplied function?

• Yes, you can make such a plot in Matlab using surf and contour3, and similarly in Python with Matplotlib's mplot3d toolkit. // If you can replicate the original animation, can't you also visualize the inverse transformation just by playing the animation backwards? – user856 Jan 15 at 19:18
• @Rahul: I think the OP's question assumed you are given only the projected contour plot and need to infer the three-dimensional surface.... no "playing a projection backward." – David G. Stork Jan 15 at 19:25
• @David: Well at the end of the sentence they say "for such a user supplied function". So I assumed one has the function itself and not merely a finite number of its contours. – user856 Jan 15 at 20:47
• @Rahul I meant that either the user can supply the algebraic function for the surface and the program transforms the surface ultimately into a contour plot, or the user can supply the algebraic function for the contour plot and the program transforms the contour plot ultimately into a surface. – user10478 Jan 16 at 16:46
• What does that mean, "the algebraic function for the contour plot"? Don't both plots visualize the same function $\mathbb R^2\to\mathbb R$? – user856 Jan 18 at 13:50 In Mathematica (which certainly has Windows-compatible versions):

surface =
Plot3D[2.5 + Sin[x^2 y],
{x, -2, 2}, {y, -2, 2},
MeshFunctions -> {#3 &},
Mesh -> 10,
MeshStyle -> Directive[Blue, Thickness[0.009]],
PlotStyle -> Opacity[0.7]];

slice =
SliceContourPlot3D[2.5+Sin[x^2 y],
{"ZStackedPlanes", 1},
{x, -2, 2}, {y, -2, 2}, {z, -2, 2},
ContourStyle -> Directive[Blue, Thickness[0.009]]];

Show[surface,slice]


I think you may want to get access to more powerful tools than freeware.

The only way you can go from a contour plot up to a three-dimensional plot is to first infer the function.