2
$\begingroup$

A simple question but, unfortunately, I could not find the answer. Suppose I have a ListContourPlot built from some data set, e.g.,

plot = ListContourPlot[RandomReal[1, {50, 3}], ContourLabels -> All];
Show[plot, Graphics[{Red, PointSize[Large], Point[{0.5, 0.5}]}]]

ListContourPlot example

I need to be able to determine whether a particular point lies within a given range on this contour plot. For example, I want to check if the red point with coordinates {0.5,0.5} on my contour plot would fall between the contour lines 0.4 and 0.6. Notice that this point is not necessarily a part of the original data set used to make the plot. Just a True/False result of such a test would do.

$\endgroup$

1 Answer 1

2
$\begingroup$
pts = RandomReal[1, {50, 3}];
plot = ListContourPlot[pts, ContourLabels -> All];
Show[plot, Graphics[{Red, PointSize[Large], Point[{0.5, 0.5}]}]]

Mathematica graphics

ip = Interpolation[pts, InterpolationOrder -> All];

0.4 < ip[0.5, 0.5] < 0.6

False

$\endgroup$
1
  • $\begingroup$ thanks! that's much simpler than I thought. $\endgroup$ Commented Nov 5, 2014 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.