# Converting a 3D Plot to a Region Plot [duplicate]

I have a 3D Plot with 3 separate functions for z in terms of x and y. I would like to convert this to a RegionPlot with the max of the three functions plotted for the variables x and y.

Essentially, this would be the top view of the 3D Plot, as whatever function is visible from the top is the highest and thus the maximum at that point.

However, I also need to add a Manipulate to this so it cannot merely be an image of the top view of the 3D Plot.

 Manipulate[
Plot3D[{0.1,
Piecewise[{{α - ((2 α - 1)  α)/y + (
x*α^2)/(2 y ), (1 - α) + α^2/(2 y) >=
0.35}}],
Piecewise[{{α + (1 - α)^2/(
2 y), (1 - α) + (((3 α -
1) - ((Abs[1 - x]) (1 - α))) (1 - α))/(
2 y) >= 0.35}}],
Piecewise[{{α - ((2 α - 1) α)/((2 -
a) 2) + ((3 - 2 a - Abs[x - a] ) α^2)/(
2 y*(2 - a)^2), (1 - α) + α^2/(2 y (2 - a)) >=
0.35}}]} /. {a -> ((1 + z)/2), x -> 1} //
Evaluate, {α, 0, 1}, {z, 0, 1},
AxesLabel -> Automatic,
PlotRange -> Automatic,
PlotStyle -> {Black, Green, Orange, Blue}], {{y, 2,
Gamma}, 1, 5}]


I would like a 2D Plot from this top view

-

## marked as duplicate by Rahul, MarcoB, Yves Klett, Bob Hanlon, Michael E2 plotting StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jan 5 at 3:30

Here are three example functions,

f1 = Exp[-x^2 - y^2];
f2 = .5 Sin[x - y];
f3 = .002 x^2 + .07 y^2;


And here is a top-down view of the 3D plot,

Plot3D[{f1, f2, f3}, {x, -6, 6}, {y, -4, 4}, PlotPoints -> 100,
ViewCenter -> {0.5, 0.5, 0.5}, ViewPoint -> {0, 0, 4}]


And here is the same view, using RegionPlot

RegionPlot[{
f1 > f2 && f1 > f3,
f2 > f1 && f2 > f3,
f3 > f1 && f3 > f2},
{x, -6, 6}, {y, -4, 4},
BoundaryStyle -> Dashed]


Manipulate[
Module[{flist, f1, f2, f3, f4},
flist = {f1, f2, f3, f4} =
Evaluate[{0.1,
Piecewise[{{α - ((2 α - 1) α)/

y + (x*α^2)/(2 y), (1 - α) + α^2/(2 \
y) >= 0.35}}],

Piecewise[{{α + (1 - α)^2/(2 y), (1 - α) +
(((3 α -
1) - ((Abs[
1 - x]) (1 - α))) (1 - α))/(2 y) >= \

0.35}}],

Piecewise[{{α - ((2 α - 1) α)/((2 -
a) 2) + ((3 - 2 a -
Abs[x - a]) α^2)/(2 y*(2 -

a)^2), (1 - α) + α^2/(2 y (2 - a)) >=
0.35}}]} /. {a -> ((1 + z)/2), x -> 1}];
RegionPlot[{
f1 == Max@flist,
f2 == Max@flist,
f3 == Max@flist,
f4 == Max@flist
}, {α, 0, 1}, {z, 0, 1},
BoundaryStyle -> None
, PlotPoints -> 50, PlotStyle -> {Black, Green, Orange, Blue}]
]
, {{y, 2, Gamma}, 1, 5}]


Using the PlotPoints option severely slows it down, but makes the plot smoother.

-

Here's my answer here applied to this question:

Manipulate[
With[{fns = {0.1,
Piecewise[{{α - ((2 α - 1) α)/y + (x*α^2)/(2 y), (1 - α) + α^2/(2 y) >= 0.35}}],
Piecewise[{{α + (1 - α)^2/(2 y),
(1 - α) + (((3 α - 1) - ((Abs[1 - x]) (1 - α))) (1 - α))/(2 y) >= 0.35}}],
Piecewise[{{α - ((2 α - 1) α)/
((2 - a) 2) + ((3 - 2 a - Abs[x - a]) α^2)/(2 y*(2 - a)^2),
(1 - α) + α^2/(2 y (2 - a)) >= 0.35}}]} /. {a -> ((1 + z)/2), x -> 1}},
ContourPlot[Ordering[fns, -1], {α, 0, 1}, {z, 0, 1},
Contours -> 1/2 + Range[Length@fns - 1],
ContourShading -> {Black, Green, Orange, Blue},
MaxRecursion -> ControlActive[1, 4]]
],
{{y, 2, Gamma}, 1, 5}]


-