1
$\begingroup$

I have 2D values of a calculation the example dimension is 6x8 but normally I deal with dimensions 500s.I use ListPlot3D but I don't know how to impose the coordinates there without manipluating the 2D matrix and arrays and create something like {{x,y,value},{x,y,value}......}

fff = {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 
5.475791142740877`, -14.272825786774677`, 33.4382839562968`, 
64.29895513872745`, -68.0961640025078`, -84.55409049545428`, \
-200.43168128179911`}, {0, 108.2809132864027`, 96.33066430481864`, 
67.39038634897949`, -22.450932256751088`, -135.51651024533695`, \
-114.91838242492751`, 116.66288335614024`}, {0, 119.2795790153213`, 
65.8259686873095`, 142.50591927548047`, -110.7506031206303`, 
86.88430514579899`, -277.43024833209427`, -663.5701425108603`}, \
{0, 25.83813396477188`, 65.60966523505152`, -55.32158023192134`, 
17.625431413588235`, -218.01432554895248`, 163.51192536446618`, 
269.1632999426581`}, {0, 0, 0, 0, 0, 0, 0, 0}};
ListPlot3D[fff, ImageSize -> Large, Mesh -> {50, 50}]

and lets assume that

x={0., 0.2, 0.4, 0.6, 0.8, 1.}; 
y={0., 0.07142857142857142, 0.14285714285714285, 0.21428571428571427, 
 0.2857142857142857, 0.3571428571428571, 0.42857142857142855, 0.5}

Is there something like PlotMagic[fff,x,y]? If not how can I create {{x1,y1,value11},{x1,y2,value12}......} efficiently?

Thank you

$\endgroup$
1
$\begingroup$

Probably there is more elegant way to do it

pts = Join @@ 
  Table[{x[[i]], y[[j]], fff[[i, j]]}, {i, Length@x}, {j, Length@y}]
ListPointPlot3D[pts]
$\endgroup$
  • $\begingroup$ I apologize, did not see your answer $\endgroup$ – Alex Trounev Aug 25 '18 at 12:45
  • $\begingroup$ Thanks, really elegant and I can also use ListPlot3D because I would like a surface. $\endgroup$ – Erdem Aug 25 '18 at 15:30
1
$\begingroup$
fff = {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 
    5.475791142740877`, -14.272825786774677`, 33.4382839562968`, 
    64.29895513872745`, -68.0961640025078`, -84.55409049545428`, \
-200.43168128179911`}, {0, 108.2809132864027`, 96.33066430481864`, 
    67.39038634897949`, -22.450932256751088`, -135.51651024533695`, \
-114.91838242492751`, 116.66288335614024`}, {0, 119.2795790153213`, 
    65.8259686873095`, 142.50591927548047`, -110.7506031206303`, 
    86.88430514579899`, -277.43024833209427`, -663.5701425108603`}, \
{0, 25.83813396477188`, 65.60966523505152`, -55.32158023192134`, 
    17.625431413588235`, -218.01432554895248`, 163.51192536446618`, 
    269.1632999426581`}, {0, 0, 0, 0, 0, 0, 0, 0}};
x = {0., 0.2, 0.4, 0.6, 0.8, 1.};
y = {0., 0.07142857142857142, 0.14285714285714285, 
   0.21428571428571427, 0.2857142857142857, 0.3571428571428571, 
   0.42857142857142855, 0.5};
f = Table[{x[[i]], y[[j]], fff[[i, j]]}, {i, 1, Length[x]}, {j, 1, 
   Length[y]}];
ListPointPlot3D[f,, AxesLabel -> {"x", "y", "fff"}]

fig1

$\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.