# Drawing a RegionPlot but for data instead of a function

I am trying to draw something similar to RegionPlot, but instead of functions I only have data matrices. For example, I have the following 3 pieces of data (simplified for this question) and I want to show the 3 regions where one is larger than the other two. That is, I want to plot the 3 regions where {EAR>SDM && EAR>ADMC}, {SDM>EAR && SDM>ADMC}, {ADMC>EAR && ADMC>SDM}:

EAR = {{0.107749, 0.107749, 0.107749}, {0.0744855, 0.0713607, 0.069264},
{0.0581068, 0.0537309, 0.0508256}}

SDM = {{0.0514403, 0.0377929, 0.0289352}, {0.0514403, 0.0377929, 0.0289352},
{0.0514403, 0.0377929, 0.0289352}}

ADMC = {{0.077505, 0.0689003, 0.062779}, {0.0659348, 0.0579942, 0.052373},
{0.0572223, 0.0498253, 0.0446134}}


What I would like to produce is a region plot similar to this one here which I produced using the RegionPlot command and functions that are very similar (but not exactly like) to the data given above (and obviously a lot more intermediate points drawn by the Mathematica RegionPlot command). I produced this plot with this code:

RegionPlot[{EARstar[delta, r, sigma, rho, lambda, k] > SDM[delta, r, sigma, rho, lambda, k]
&& EARstar[delta, r, sigma, rho, lambda, k] > ADMC[delta, r, sigma, rho, lambda, k],
SDM[delta, r, sigma, rho, lambda, k] > EARstar[delta, r, sigma, rho, lambda, k] &&
SDM[delta, r, sigma, rho, lambda, k] > ADMC[delta, r, sigma, rho, lambda, k],
ADMC[delta, r, sigma, rho, lambda, k] > EARstar[delta, r, sigma, rho, lambda, k] &&
ADMC[delta, r, sigma, rho, lambda, k] > SDM[delta, r, sigma, rho, lambda, k] && },
{lambda, 1, 2}, {r, 1, 10}]


While the commands ListLinePlot and ListPlot3D do pretty much exactly the same as Plot and Plot3D the command ListRegionPlot does not exist.

It was easy for me to draw data similar (but more detailed) to the one listed above with ListPlot3D (see image below) but I would really prefer the simpler 2D visualization of a command similar to RegionPlot. Is there a workaround I could use?

• Probably I'm been silly here but I don't understand how are EAR, SDM, and ADMC defining regions. – rhermans Sep 27 '15 at 8:34
• You can achieve a decent 2D projection effect with your ListPlot3D approach with the following options: ViewPoint -> {0, 0, Infinity}, Mesh -> None, Lighting -> {{"Ambient", White}}, PlotRangePadding -> 0, Axes -> {True, True, False}. – shrx Sep 27 '15 at 11:42
• @shrx That's great and does EXACTLY what I want. The only downside is that I can't enlarge it after drawing it because any click on the diagram will destroy the ViewPoint. – Ach wie gut dass niemand weiß Sep 27 '15 at 15:28
• EDIT: Nevermind, I figured out how to do it by setting ImageSize -> Large – Ach wie gut dass niemand weiß Sep 27 '15 at 15:47
• @Achwiegutdassniemandweiß What I don't understand is, how can a ListPlot3D solution that @shrx gives be exactly what you want, when you explicitly ask of the RegionPlot method? Can we close this question or are still interested in an answer to your original question? – halirutan Sep 29 '15 at 8:31

## 1 Answer

One very easy way is to interpolate your data matrices so that you can use them like normal functions. Let me give a simple example where data1 and data2 are supposed to be your data matrices:

data1 = Table[Exp[-(x^2 + y^2)], {x, -1, 1, 2/10}, {y, -1, 1, 2/10}];
data2 = Table[2 Sin[2 x + 2 y], {x, -1, 1, 2/10}, {y, -1, 1, 2/10}];
ListPlot3D[{data1, data2}] Now we want to find the region where the golden surface is above the blue one and for this, we simply interpolate the matrices and use RegionPlot as usual:

{f1, f2} = ListInterpolation[#, {{-1, 1}, {-1, 1}}] & /@ {data1, data2};
RegionPlot[f1[x, y] > f2[x, y], {x, -1, 1}, {y, -1, 1}] When your data is large, then you might have to watch whether the performance is still acceptable. One way to speed things up is to reduce the InterpolationOrder to 1 or 2.