2.73 Visualize a 2D matrix

Problem: Given a 2 dimensional matrix, say \(m\times n\,\), how to visualize its content?

These are some examples showing how to visualize a matrix as a 3D data, where the height is taken as the values of the matrix entries, and the \(x,y\,\ \)indices as the coordinates.

Mathematica

mat = Table[Table[RandomReal[{0,100}], 
       {20}],{10}]; 
ListPointPlot3D[mat,Filling->Axis 
                   ,ImageSize->300]
 

pict

mat = HilbertMatrix[{20,10}]; 
ListPlot3D[mat,Mesh->None,InterpolationOrder->0, 
     ColorFunction->"SouthwestColors", 
     Filling->Axis,ImageSize->300]
 

pict

Matlab

clear all; close all; 
 
A     = (100).*rand(20,20); 
[X,Y] = meshgrid(1:20,1:20); 
 
surfl(X,Y,A); 
shading interp 
colormap(gray);
 

PIC

figure; 
A     = hilb(20); 
[X,Y] = meshgrid(1:20,1:20); 
surfl(X,Y,A);
 

PIC

Maple

restart; 
A := abs(LinearAlgebra[RandomMatrix](20,10,generator=0..100)): 
plots[matrixplot](A,heights=histogram);
 

pict

A := LinearAlgebra[HilbertMatrix](20,10): 
A := convert(A,listlist): 
plots[listplot3d](A);
                                                                                    
                                                                                    
 

pict