# Visualizing the reverse pyramid in a good way

I'm trying to draw, for a series of multivariables functions, both the surface plot and the level curves. I am using the following code:

contourPotentialPlot1 =
ContourPlot[Abs[x] + Abs[y], {x, -3, 3}, {y, -3, 3},
PlotRange -> {-5, 15}, Contours -> 15, Axes -> False,
PlotPoints -> 30, PlotRangePadding -> 0, Frame -> False,
ColorFunction -> "BlueGreenYellow"];

potential1 =
Plot3D[Abs[x] + Abs[y], {x, -3, 3}, {y, -3, 3},
PlotRange -> {-5, 5}, ClippingStyle -> None,
MeshFunctions -> {#3 &}, Mesh -> 15, MeshStyle -> Opacity[.5],
LightBlue}}, Lighting -> "Neutral"];

level = -5; gr =
Graphics3D[{Texture[contourPotentialPlot1], EdgeForm[],
Polygon[{{-3, -3, level}, {3, -3, level}, {3, 3, level}, {-3, 3,
level}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]},
Lighting -> "Neutral"];

Show[potential1, gr, PlotRange -> All, BoxRatios -> {1, 1, .6},
FaceGrids -> {Back, Left}]

The output is the following:


How can I modify the code to visualize a "good" reverse pyramid (which is what comes out from the plot of $$z = |x| + |y|$$)? From the above one it's not clear that it's a pyramid.

Thank you!

I tried to modify the BoxRations parameters, and with something like {1, 1, 2.6} the effect is a bit better, but still it looks like something forces. I would like to observe a "more pyramidical" plot :D

You can use RegionFunction and give it a region of interest over which you want to plot (ie. rotated square in your case).

regFunc[x_, y_, z_] := Abs[x] + Abs[y] < 3;

potential1 =
Plot3D[Abs[x] + Abs[y], {x, -3, 3}, {y, -3, 3}, PlotRange -> {-5, 5},
RegionFunction -> regFunc, ClippingStyle -> None,
MeshFunctions -> {#3 &}, Mesh -> 15, MeshStyle -> Opacity[.5],
LightBlue}}, Lighting -> "Neutral"]


• Thank you so much!!! Feb 23 at 21:46
Clear["Global*"];
level = 4;
potential1 = Plot3D[Abs[x] + Abs[y]
, {x, -4, 4}, {y, -4, 4}
, PlotRange -> {-5, 5}
, ClippingStyle -> None
, MeshFunctions -> {#3 &}
, Mesh -> 15
, MeshStyle -> Opacity[.5]
{Opacity[.9, LightBlue]}
, {Opacity[0.5, LightBlue]}
}
, Lighting -> "Neutral"
, ClipPlanes -> {InfinitePlane[
{{0, 0, level}, {0, 1, level}, {1, 0, level}}]}
, ClipPlanesStyle -> Opacity[.4, Gray]
, BoxRatios -> Automatic
];

scp = SliceContourPlot3D[Abs[x] + Abs[y], {z == -level}
, {x, -4, 4}, {y, -4, 4}, {z, -5, 5}
, PlotRange -> {{-4, 4}, {-4, 4}, {-5, -5}}
, Contours -> Range[0, 6]
, ColorFunction -> "BlueGreenYellow"
];

Show[potential1, scp, PlotRange -> All, FaceGrids -> {Back, Left}]
`