plot a Matrix - Maple Help

plots

 matrixplot
 3-D plot with z values determined by a matrix

 Calling Sequence matrixplot(A, options)

Parameters

 A - Matrix options - (optional) equations of the form option=value where option is one of dimension, cellstyle, gap, color, colorbar, or other plot options

Options

 • The remaining arguments are options specified as equations of the form option = value.  The matrixplot specific options are:
 dimension=d
 Where d is 2 or 3, and defaults to 3
 cellstyle=s
 Where s is either discrete or continuous, the default in three dimensions is continuous and in two dimensions is discrete. The older syntax heights=histogram is equivalent to cellstyle=discrete.
 gap=r
 The value of r is a real number between 0 and 1 and is only used for discrete style plots.
 color=F
 The color of the plot is given by F,  where F is a color specification as described in the plot/color help page. F can also be a two-argument procedure returning a single real value to be interpreted as a hue rather than RGB value.
 colorbar=c
 where c is true, false or a list of color bar options. The default is true for two-dimensional plots, and false for three dimensions. The options supported are described in plot/colorbar.
 Other options are treated as general plot options. These include axes, view, title, labels, style, projection, and orientation.  See plot3d/option and plot/option.

Description

 • The matrixplot function defines a three-dimensional graph where the x and y coordinates represent the row and column indices of A, respectively. The z values are the corresponding entries of A.
 • The result of a call to matrixplot is a plot structure which can be rendered by the plotting device. You can assign a plot to a variable, save it in a file, then read it back in for redisplay.  See plot3d/structure for more information.

Examples

 > $\mathrm{with}\left(\mathrm{plots}\right):$
 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $A≔\mathrm{HilbertMatrix}\left(8\right):$$B≔\mathrm{ToeplitzMatrix}\left(\left[1,2,3,4,-4,-3,-2,-1\right],\mathrm{symmetric}\right):$
 > $\mathrm{matrixplot}\left(A·B\right)$
 > $\mathrm{matrixplot}\left(A·B,'\mathrm{dimension}'=2\right)$
 > $\mathrm{matrixplot}\left(A+B,'\mathrm{cellstyle}'='\mathrm{discrete}','\mathrm{axes}'='\mathrm{boxed}'\right)$
 > $\mathrm{matrixplot}\left(A+B,'\mathrm{cellstyle}'='\mathrm{discrete}','\mathrm{gap}'=0.25,'\mathrm{axes}'='\mathrm{frame}'\right)$
 > $\mathrm{matrixplot}\left(A+B,'\mathrm{dimension}'=2,'\mathrm{cellstyle}'='\mathrm{continuous}'\right)$
 > $F≔\left(x,y\right)↦\mathrm{sin}\left(y\cdot x\right):$
 > $\mathrm{matrixplot}\left(A+B,'\mathrm{cellstyle}'='\mathrm{discrete}','\mathrm{gap}'=0.25,'\mathrm{color}'=F,'\mathrm{axes}'='\mathrm{frame}'\right)$
 > $L≔\mathrm{HilbertMatrix}\left(4,5\right)$
 ${L}{≔}\left[\begin{array}{ccccc}{1}& \frac{{1}}{{2}}& \frac{{1}}{{3}}& \frac{{1}}{{4}}& \frac{{1}}{{5}}\\ \frac{{1}}{{2}}& \frac{{1}}{{3}}& \frac{{1}}{{4}}& \frac{{1}}{{5}}& \frac{{1}}{{6}}\\ \frac{{1}}{{3}}& \frac{{1}}{{4}}& \frac{{1}}{{5}}& \frac{{1}}{{6}}& \frac{{1}}{{7}}\\ \frac{{1}}{{4}}& \frac{{1}}{{5}}& \frac{{1}}{{6}}& \frac{{1}}{{7}}& \frac{{1}}{{8}}\end{array}\right]$ (1)
 > $\mathrm{matrixplot}\left(L\right)$
 > $Y≔\mathrm{Matrix}\left(20,3,\left(i,j\right)↦\mathrm{evalf}\left(1+\mathrm{sin}\left(\frac{i\cdot j}{\mathrm{\pi }}\right)\right),\mathrm{datatype}=\mathrm{float}\left[8\right]\right):$
 > $\mathrm{plots}:-\mathrm{matrixplot}\left(Y,'\mathrm{cellstyle}'='\mathrm{discrete}',\mathrm{gap}=0.5,\mathrm{=}\left(\mathrm{color},\left(x,y\right)↦1.2-\frac{y}{3}\right),\mathrm{orientation}=\left[-55,55,0\right],\mathrm{labels}=\left["","",""\right]\right)$

The command to create the plot from the Plotting Guide is

 > $\mathrm{matrixplot}\left(A\right)$

Compatibility

 • The plots[matrixplot] command was updated in Maple 2024.
 • The dimension, cellstyle and colorbar options were introduced in Maple 2024.