2
$\begingroup$

I have 3 matrices, each of size $101 \times 101$.

List6 = Table[{x1[[i, j]]}, {i, 101}, {j, 101}]
List7 = Table[{y1[[i, j]]}, {i, 101}, {j, 101}]
List8 = Table[{xDisp1[[i, j]]}, {i, 101}, {j, 101}]

and I want to use ListContourPlot

ListContourPlot[{{x1[[1,1],y1[[1,1]],xDisp[[1,1]]},{x1[[1,2],y1[[1,2]],xDisp[[1,2]]},....}]  

How could I use ListContourPlot from the three lists using the sequence I have given above ?

Best Regards

$\endgroup$
1
$\begingroup$

I don't think it makes much sense to create a ListContourPlot with two or more separate lists. What do you think it should look like? How will you display three different values at a given location?

I'd use ListPlot3D to keep the data sets visible:

list1 = Table[RandomReal[], {20}, {20}];
list2 = Table[.5 + .3 RandomReal[], {20}, {20}];
list3 = Table[1 + .2 RandomReal[], {20}, {20}];

ListPlot3D[{list1, list2, list3},
 InterpolationOrder -> 0,
 PlotStyle -> {{Opacity[0.5], Blue}, 
               {Opacity[0.5], Yellow}, 
               {Opacity[0.5], Red}}]
$\endgroup$
  • $\begingroup$ I just want to learn how could I manipulate my lists to be suitable for listcontourplot function ? Then i will compare it with an another study given in contourplot $\endgroup$ – user45055 Oct 26 '17 at 17:43
  • $\begingroup$ Manipulating lists is not the problem or issue. You haven't specified what you want your graph to look like, so it is impossible to answer your question. Why not simply print three separate contour plots, side-by-side? $\endgroup$ – David G. Stork Oct 26 '17 at 21:10
0
$\begingroup$

Use your own matrices x1, y1 and xDisp1 in place of the random ones below:

m = 30;
x1 = RandomReal[1, {m, m}];
y1 = RandomReal[1, {m, m}];
xDisp1 = RandomReal[10, {m, m}];

data = Join @@ 
   Table[{x1[[i, j]], y1[[i, j]], xDisp1[[i, j]]}, {i, 1, m}, {j, 1, m}];
(* or  data = Join @@ (Transpose /@ Transpose[{x1, y1, xDisp1}]) *)

ListContourPlot[data, InterpolationOrder -> 0, ColorFunction -> "Rainbow"]

enter image description here

If you need to work with list6, list7 and list8

list6 = Table[{x1[[i, j]]}, {i, m}, {j, m}];
list7 = Table[{y1[[i, j]]}, {i, m}, {j, m}];
list8 = Table[{xDisp1[[i, j]]}, {i, m}, {j, m}];

you can use

data2 = Join @@ 
   Table[{list6[[i, j, 1]], list7[[i, j, 1]], list8[[i, j, 1]]}, {i, 1, m}, {j, 1, m}];
data == data2

True

Alternatively, use

data2 = Join @@ (Transpose /@ 
    Transpose[{list6[[All, All, 1]], list7[[All, All, 1]], list8[[All, All, 1]]}])
$\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.