3
$\begingroup$

I use ListContourPlot to show exclusions in a physical parameter space. I have restrictions like A < 5 and B > 120. I also have data lists in the form of {{Input1, Input2, A, B, C, ...}, {Input,....}}. I create lists of triplets with the inputs as x and y coordinates and the interesting quantity as a third: AList = {{Input1, Input2, A}, {Input1, Input2, A}, ...}. Then I simply use ListContourPlot[AList, Contours -> {5}, ContourShading -> {None, Red}] to create a red shape that covers the excluded area. I do this e.g. in red and blue for A and B respectively. Then I use Show[LCP1, LCP2, ...] to overlay them into a single plot.

Now, it would be nice to also show the area that is excluded by A and B in a third color. Is there a possibility to create contours based on two criteria?

I manged to get what I want, by creating a list of elements that fulfill criterion A and then plot the exclusion for B the same way as above then doing it once over with a list of elements that fulfill criterion B and plot the exclusion for A. This is cumbersome, however, so I wonder whether it is possible to do it in one step.

$\endgroup$
  • $\begingroup$ AList = {{Input1, Input2, A}, {Input1, Input2, A}, ...} doesn't reveal your intentions, I think $\endgroup$ – Dr. belisarius Apr 19 '13 at 12:28
  • $\begingroup$ I think I didn't really understand your question. Could you provide some minimal concrete data sample and code? $\endgroup$ – Silvia Apr 19 '13 at 16:44
2
$\begingroup$

Perhaps you could interpolate your data and use RegionPlot:

(* example data *)
alist = Table[{x, y, (x + 2)^2 + y^2}, {x, -5, 5, 0.1}, {y, -5, 5, 0.1}]~Flatten~1;
blist = Table[{x, y, 15 (x - 2)^2 + 10 y^2}, {x, -5, 5, 0.1}, {y, -5, 5, 0.1}]~Flatten~1;

(* interpolation *)
afunc = Interpolation[alist];
bfunc = Interpolation[blist];

(* plotting *)
With[{a = afunc[x, y] < 5, b = bfunc[x, y] > 120}, 
 RegionPlot[{a, b, a && b}, {x, -5, 5}, {y, -5, 5}, PlotStyle -> {Red, Green, Blue}]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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