Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How does list_plot3d interpret nxn matrices?

From the documentation of list_plot3d


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)

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)