# How does list_plot3d interpret nxn matrices?

From the documentation of list_plot3d

INPUT:

v - something that defines a set of points in 3 space, for example:

• a matrix
• a list of 3-tuples
• a list of lists (all of the same length) - this is treated the same as a matrix.

Intuitively I would guess that the function would only accept $3 \times n$ matrices and/or their transposes, but the first example on the document page is a plot of a five by five matrix

n = 5
m = matrix(RDF, n, [(i+j)%n for i in [1..n] for j in [1..n]])
p = list_plot3d(m)
p


Question: How does list_plot3d interpret this $5 \times 5$ matrix as a set of points in 3-space?

One might suspect that list_plot3d handles matrices the same was as, for example, point3d but this is not the case. For example, the points visualized by point3d do not lie on the surface given by list_plot3d in the above example as witnessed by

p + point3d(m, size=33)

edit retag close merge delete

Sort by » oldest newest most voted I agree that it is completely unclear from the documentation. I believe that if m is a matrix, then this plots the points (i,j,m_{i,j}); that is, above the point (i,j) in the (x,y)-plane, it plots the z-value m_{i,j}.

more

That makes sense. And it also serves as a natural 3D extension to the output obtained from calling plot or matrix_plot an an $n \times n$ matrix.

As a side note, the behavior of list_plot3d and point3d on matrices do not seem related.