0
$\begingroup$

I've go data like this:

{ { "name", x1,  x2,  x3,  x4  },
  { y1,     a11, a12, a13, a14 },
  { y2,     a21, a22, a23, a24 },
  ....
}

where aij is the value of some data at point (xi, yj).

What would be the most straightforward way to display such data as a 3D plot or 3D surface? Ditto when one of the labels scales logarithmically and the other one linearly?

$\endgroup$
2
$\begingroup$

Restructure the data:

data = RandomReal[1, {5, 5}];

x = data[[1, 2 ;; All]]

y = data[[2 ;; All, 1]]

a = data[[2 ;; All, 2 ;; All]]

coords = Flatten[#, 1]& @
  Table[{x[[i]], y[[i]], a[[i, j]]}, {i, 1, Length @ x}, {j, 1, Length @ y}]

ListPlot3D @ coords

enter image description here

| improve this answer | |
$\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.