Given a (possibly disjoint) region, defined by a discrete set of points, how can I use ListContourPlot[]
together with Mesh
to highlight a specific area of the plot? For instance, how can I mesh the region where the points are smaller than a certain value?
Here I construct a minimal example where I try to highlight the area where the values of a discrete sample of the function $f(x) = e^{x^2 - y^2}$ are smaller then one.
data = Table[Exp[x^2 - y^2], {x, -1, 1, .01}, {y, -1, 1, .01}];
ListContourPlot[
data
, Contours -> {1.0}
, ContourStyle -> Transparent
, Mesh -> 25
, MeshFunctions -> {#1 + #2 &}
, MeshStyle -> Thick
]
I also tried using MeshFunctions -> {Piecewise[{{#1 + #2 &, #3 <= 1 &}, {None, #3 > 0 &}}]}
, but I had no luck.
I am aware that this can be done for symbolic functions through RegionPlot[]
, however I am not sure how to extend this to numerical data.
MeshFunctions -> {( # + #2) Boole[#3 <= 1] &}
? $\endgroup$data = Table[Exp[x^2 - y^2], {x, -1, 1, .01}, {y, -1, 1, .01}]; ListContourPlot[data, Contours -> {1.0}, ContourStyle -> Transparent, Mesh -> 25, MeshFunctions -> {Function[{x, y, f}, If[f > 1, x + y, 0]], Function[{x, y, f}, If[f < 1, x - y, 0]]}, MeshStyle -> {Red, Directive[Thick, Green]}]
$\endgroup$