Skip to main content
added 192 characters in body
Source Link

Here is a method that uses only Plot3D[] with its MeshFunctions option, and achieves the desired result with a little post-processing:

p1 = Normal[Plot3D[x + y - x y, {x, -5, 5}, {y, -5, 5}, ClippingStyle
                   BoundaryStyle -> NoneDirective[GrayLevel[2/3], AbsoluteThickness[1]], 
                   ClippingStyle -> None, ColorFunction -> "Rainbow", 
                   MeshFunctions -> {#3 &},
                   MeshStyle -> Directive[AbsoluteThickness[1.6], ColorData[97, 1]], 
                   PlotStyle -> Opacity[0.9], PlotTheme -> "Detailed"]];
tr = TranslationTransform[AffineTransform[{DiagonalMatrix[{1, 1, 0}], {0, 0, PlotRange[p1][[-1, 1]]}}];

p1 /. Line[l_] :> {GrayLevel[0, 1], Line[tr @ l.DiagonalMatrix[{1, 1, 0}]]}l]

surface and projected contourssurface and projected contours

Here is a method that uses only Plot3D[] with its MeshFunctions option, and achieves the desired result with a little post-processing:

p1 = Normal[Plot3D[x + y - x y, {x, -5, 5}, {y, -5, 5}, ClippingStyle -> None,  
                   ColorFunction -> "Rainbow", MeshFunctions -> {#3 &},
                   PlotStyle -> Opacity[0.9], PlotTheme -> "Detailed"]];
tr = TranslationTransform[{0, 0, PlotRange[p1][[-1, 1]]}];

p1 /. Line[l_] :> {GrayLevel[0, 1], Line[tr @ l.DiagonalMatrix[{1, 1, 0}]]}

surface and projected contours

Here is a method that uses only Plot3D[] with its MeshFunctions option, and achieves the desired result with a little post-processing:

p1 = Normal[Plot3D[x + y - x y, {x, -5, 5}, {y, -5, 5}, 
                   BoundaryStyle -> Directive[GrayLevel[2/3], AbsoluteThickness[1]], 
                   ClippingStyle -> None, ColorFunction -> "Rainbow", 
                   MeshFunctions -> {#3 &},
                   MeshStyle -> Directive[AbsoluteThickness[1.6], ColorData[97, 1]], 
                   PlotStyle -> Opacity[0.9], PlotTheme -> "Detailed"]];
tr = AffineTransform[{DiagonalMatrix[{1, 1, 0}], {0, 0, PlotRange[p1][[-1, 1]]}}];

p1 /. Line[l_] :> Line[tr @ l]

surface and projected contours

Source Link

Here is a method that uses only Plot3D[] with its MeshFunctions option, and achieves the desired result with a little post-processing:

p1 = Normal[Plot3D[x + y - x y, {x, -5, 5}, {y, -5, 5}, ClippingStyle -> None,  
                   ColorFunction -> "Rainbow", MeshFunctions -> {#3 &},
                   PlotStyle -> Opacity[0.9], PlotTheme -> "Detailed"]];
tr = TranslationTransform[{0, 0, PlotRange[p1][[-1, 1]]}];

p1 /. Line[l_] :> {GrayLevel[0, 1], Line[tr @ l.DiagonalMatrix[{1, 1, 0}]]}

surface and projected contours