Ask Your Question

How does list_plot3d interpret nxn matrices?

asked 2018-04-18 13:34:16 -0500

amdall gravatar image

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)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-04-18 23:38:09 -0500

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}.

edit flag offensive delete link 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.

amdall gravatar imageamdall ( 2018-04-19 00:22:00 -0500 )edit

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

amdall gravatar imageamdall ( 2018-04-19 00:22:11 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-04-18 13:34:16 -0500

Seen: 35 times

Last updated: Apr 18