0
$\begingroup$

I used ListContourPlot to specify an area for which the function value is less than a number. For example consider the following areas:

 plot1 = ListContourPlot[
  Table[Sin[i + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}], 
  RegionFunction -> Function[{x, y, z}, z < 1], PlotRange -> {0, 1}, 
  DataRange -> {{0, 3}, {0, 3}}]

plot2 = ListContourPlot[
  Table[Cos[i + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}], 
  RegionFunction -> Function[{x, y, z}, z < 0.7]
  , PlotRange -> {0, .7}, DataRange -> {{0, 3}, {0, 3}}, 
  ColorFunction -> ColorData["BlackBodySpectrum"]]

enter image description here

enter image description here

How can I specify the common areas of these two parameter spaces in a plot?

RegionPlot doesn't give the common area:

RegionPlot[
 Sin[i + j^2] < 1 && Cos[i + j^2] < 0.7, {i, 0, 3}, {j, 0, 3}, 
 PlotPoints -> 80, Mesh -> 2, 
 ColorFunction -> 
  Function[{x, y}, ColorData["SolarColors"][Sin[x^2 + y]]], 
 PlotRange -> {0, 2}, 
 MeshFunctions -> {Sin[#1^2 + #2] &, Abs@Cos[#1^2 + #2] &}]

enter image description here

Because RegionPlot uses i and j which change continuously but ListContourPlot uses only certain number of data:

{i, 0, 3, 0.1}, {j, 0, 3, 0.1}
$\endgroup$
  • $\begingroup$ @cormullion: RegionPlot doesn't give me what I have in my mind.Please see the comment below. $\endgroup$ – Soodeh Z. May 1 '13 at 10:15
  • $\begingroup$ Although some people have answered, which indicates they think they know what you have in mind, this question has some striking ambiguities. Perhaps if you were to explain what you mean by "parameter spaces" and how the "common areas" are defined you might get some responses that are closer to what you're looking for. For instance, is an "area" a geometric region, a rectangular extent, or is it perhaps a number representing its area? Are the "parameter spaces" the ranges of X and Y values shown in your plot or are they something else that needs to be derived from your input? $\endgroup$ – whuber May 1 '13 at 16:29
  • $\begingroup$ @whuber I confess to guessing at what I thought the question was about...but I live surrounded by vagueness and ambiguity and have gotten too used to it. :) $\endgroup$ – cormullion May 1 '13 at 21:16
2
$\begingroup$
plot1 = ListContourPlot[
                    Flatten[Table[{i, j, Sin[i + j^2]}, {i, 0, 3, 0.1}, {j, 0, 3, 0.1}], 1], 
                    RegionFunction -> Function[{x, y, z}, z < 1/2]];
plot2 = ListContourPlot[
                    Flatten[Table[{i, j, Cos[i + j^2]}, {i, 0, 3, 0.1}, {j, 0, 3, 0.1}], 1], 
                    RegionFunction -> Function[{x, y, z}, z < 0.7]];
plot3 = RegionPlot[Sin[i + j^2] < 1/2 && Cos[i + j^2] < 0.7, {i, 0, 3}, {j, 0, 3}];

GraphicsRow@{plot1, plot2, plot3}

enter image description here

$\endgroup$
  • $\begingroup$ You seem to have fixed the original plots too...:) $\endgroup$ – cormullion May 1 '13 at 15:46
  • $\begingroup$ @cormullion They were in need :=) $\endgroup$ – Dr. belisarius May 1 '13 at 15:47
  • $\begingroup$ So that's why I found it difficult to get my plot to look like the OP's... $\endgroup$ – cormullion May 1 '13 at 16:13
  • $\begingroup$ @belisarius: Thanks a lot for your help. $\endgroup$ – Soodeh Z. May 1 '13 at 16:58
3
$\begingroup$

You could try a RegionPlot:

RegionPlot[
 Sin[i^2 + j] > 0 && Abs@Cos[i^2 + j] < 0.7, {i, 0, 3}, {j, 0, 3}, 
 PlotPoints -> 80,
 Mesh -> 2,
 ColorFunction -> 
  Function[{x, y}, ColorData["SolarColors"][Sin[x ^2 + y]]],
 MeshFunctions -> {Sin[#1 ^2 + #2] &, Abs@Cos[#1 ^2 + #2] &}]

regionplot

This isn't quite the same as a combination of the original plots, though, so you'll need to experiment:

original plots

$\endgroup$
  • $\begingroup$ But RegionPlot is not the one I want: compare plot1 and RegionPlot[Sin[i + j^2] < 1, {i, 0, 3}, {j, 0, 3}]. They differ because ListContourPlot only consider the points {i, 0, 3, 0.1}, {j, 0, 3, 0.1} but RegionPlot, plot an area by considering i and j changes continuously. $\endgroup$ – Soodeh Z. May 1 '13 at 10:13
  • $\begingroup$ @soodeh No problem, I'm sure there will be other answers... $\endgroup$ – cormullion May 1 '13 at 10:22
0
$\begingroup$

Another way (I think in this way only a certain number of data are used for regionplot but I'm not sure about it):

sindata = Table[{i, j, Sin[i + j^2]}, {i, 0, 3, 0.1}, {j, 0, 3, 0.1}]~Flatten~1;
cosdata = Table[{i, j, Cos[i + j^2]}, {i, 0, 3, 0.1}, {j, 0, 3, 0.1}]~Flatten~1;

sinfunc = Interpolation[sindata];
cosfunc = Interpolation[cosdata];


With[{a = sinfunc[i, j] < 1/2, b = cosfunc[i, j] < .7}, 
 RegionPlot[{a && b}, {i, 0, 3}, {j, 0, 3},PlotStyle -> {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.