({{, (RefLink[ArrayPlot, paclet:ref/ArrayPlot])[array]
generates a plot in which the values in an array are shown in a discrete array of squares. }})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[ArrayPlot, paclet:ref/ArrayPlot])[array] by default arranges successive rows of array down the page and successive columns across, just as a table or grid would normally be formatted. »

If array contains 0s and 1s, the 1s will appear as black squares and the 0s as white squares.

(RefLink[ArrayPlot, paclet:ref/ArrayPlot]) by default generates grayscale output, in which zero values are shown white, and the maximum positive or negative value is shown black. »

With an explicit setting for (RefLink[PlotRange, paclet:ref/PlotRange]), (RefLink[ArrayPlot, paclet:ref/ArrayPlot]) by default makes the minimum value white and the maximum black.

The values in array can be quantities with units associated with them.

The following special entries can be used: »

If array is ragged, shorter rows are treated as padded on the right with background. »

(RefLink[ArrayPlot, paclet:ref/ArrayPlot]) has the same options as (RefLink[Graphics, paclet:ref/Graphics]), with the following additions and changes:

The rules given by (RefLink[ColorRules, paclet:ref/ColorRules]) are applied to the value (Subscript[a, ij]) of each cell. The rules can involve patterns. »

If none of the rules in (RefLink[ColorRules, paclet:ref/ColorRules]) apply, then (RefLink[ColorFunction, paclet:ref/ColorFunction]) is used to determine the color.

With the default setting (RefLink[ColorRules, paclet:ref/ColorRules])->(RefLink[Automatic, paclet:ref/Automatic]), an explicit setting (RefLink[ColorFunction, paclet:ref/ColorFunction])->f is used instead of (RefLink[ColorRules, paclet:ref/ColorRules]).

With (RefLink[ColorFunctionScaling, paclet:ref/ColorFunctionScaling])->(RefLink[False, paclet:ref/False]), each value (Subscript[a, ij]) is supplied as the argument to any function given for (RefLink[ColorFunction, paclet:ref/ColorFunction]). »

With (RefLink[ColorFunctionScaling, paclet:ref/ColorFunctionScaling])->(RefLink[True, paclet:ref/True]), the values are scaled to lie between 0 and 1. »

If the color determined for a particular cell is (RefLink[None, paclet:ref/None]), the cell is rendered in the background color.

If no color is determined for a particular cell, the cell is rendered in a default dark red color.

With (RefLink[DataReversed, paclet:ref/DataReversed])->(RefLink[True, paclet:ref/True]), the order of rows is reversed, so that rows run from bottom to top, with the last row at the top.

With the setting (RefLink[FrameTicks, paclet:ref/FrameTicks])->(RefLink[Automatic, paclet:ref/Automatic]), ticks are placed at round integers, typically multiples of 5 or 10. »

With the setting (RefLink[FrameTicks, paclet:ref/FrameTicks])->(RefLink[All, paclet:ref/All]), ticks are also placed at the minimum and maximum i and j. »

In explicit (RefLink[FrameTicks, paclet:ref/FrameTicks]) specifications, the tick coordinates are taken to refer to i and j.

With (RefLink[DataReversed, paclet:ref/DataReversed])->(RefLink[True, paclet:ref/True]), tick values decrease from top to bottom.

(RefLink[PlotRange, paclet:ref/PlotRange])->(Subscript[a, max]) specifies that only those (Subscript[a, ij]) between 0 and (Subscript[a, max]) should be shown. »

(RefLink[PlotRange, paclet:ref/PlotRange])->{(Subscript[a, min]),(Subscript[a, max])} specifies that (Subscript[a, ij]) between (Subscript[a, min]) and (Subscript[a, max]) should be shown.

(RefLink[PlotRange, paclet:ref/PlotRange])->{{(Subscript[i, min]),(Subscript[i, max])},{(Subscript[j, min]),(Subscript[j, max])}} shows only elements with i and j in the specified ranges. The top-left element has i==1, j==1. With the default setting (RefLink[DataReversed, paclet:ref/DataReversed])->(RefLink[False, paclet:ref/False]), i increases down the page; j increases to the right.

(RefLink[PlotRange, paclet:ref/PlotRange])->{ispec,jspec,aspec} shows only elements in the specified ranges of i, j, and value. »

With the default setting for (RefLink[ColorFunction, paclet:ref/ColorFunction]), (RefLink[PlotRange, paclet:ref/PlotRange])->{(Subscript[a, min]),(Subscript[a, max])} specifies that values from (Subscript[a, min]) to (Subscript[a, max]) should be shown with gray scales varying from white to black.

(RefLink[Mesh, paclet:ref/Mesh])->(RefLink[True, paclet:ref/True]) draws mesh lines between each cell in the array.

(RefLink[Mesh, paclet:ref/Mesh])->{(Subscript[m, i]),(Subscript[m, j])} gives mesh specifications for the i and j directions, respectively.

With the default setting (RefLink[Frame, paclet:ref/Frame])->(RefLink[Automatic, paclet:ref/Automatic]), a frame is drawn only when (RefLink[Mesh, paclet:ref/Mesh])->(RefLink[False, paclet:ref/False]).

For purposes of combining with other graphics, the array element (Subscript[a, ij]) is taken to cover a unit square centered at coordinate position x==j-1/2, y==(Subscript[i, max])-i+1/2.

A setting (RefLink[DataRange, paclet:ref/DataRange])->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}} specifies that the centers of successive cells should be at equally spaced positions between (Subscript[x, min]) and (Subscript[x, max]) in the horizontal direction, and (Subscript[y, min]) and (Subscript[y, max]) in the vertical direction. With the default setting (RefLink[DataReversed, paclet:ref/DataReversed])->(RefLink[False, paclet:ref/False]), (Subscript[a, 11]) is centered at {(Subscript[x, min]),(Subscript[y, max])}.

With the default setting (RefLink[DataRange, paclet:ref/DataRange])->(RefLink[All, paclet:ref/All]) and (RefLink[DataReversed, paclet:ref/DataReversed])->(RefLink[False, paclet:ref/False]), the array element (Subscript[a, ij]) will be taken to cover a unit square centered at coordinate position x==j-1/2, y==(Subscript[i, max])-i+1/2.

(RefLink[ArrayPlot, paclet:ref/ArrayPlot]) returns (RefLink[Graphics, paclet:ref/Graphics])[(RefLink[Raster, paclet:ref/Raster])[data],opts].

With (RefLink[PixelConstrained, paclet:ref/PixelConstrained])->(RefLink[True, paclet:ref/True]), (RefLink[ArrayPlot, paclet:ref/ArrayPlot]) generates a (RefLink[Raster, paclet:ref/Raster]) with an absolute size that aligns cells with pixels, so that each cell is an integer number of pixels across or each pixel is an integer number of cells across. The cells are each taken to be as large as possible, given the (RefLink[ImageSize, paclet:ref/ImageSize]) setting specified. »

(RefLink[ArrayPlot, paclet:ref/ArrayPlot]) works with (RefLink[SparseArray, paclet:ref/SparseArray]) objects. »

OpenersPrimaryExamplesSection(Spacer1)Examples  (94)

OpenersExampleSection0(Spacer1)Basic Examples  (6)

Plot an array of numbers:

ArrayPlot[{{1,0,0,0.3},{1,1,0,0.3},{1,0,1,0.7}}]

Give explicit color directives to specify colors for individual cells:

ArrayPlot[{{1,0,0,Pink},{1,1,0,Pink},{1,0,1,Red}}]

Specify overall color rules:

ArrayPlot[{{1,0,0,0.3},{1,1,0,0.3},{1,0,1,0.7}},ColorRules->{1->Pink,0->Yellow}]

Include a mesh:

ArrayPlot[{{1,0,0,0.3},{1,1,0,0.3},{1,0,1,0.7}},Mesh->True]

Plot a table of data:

ArrayPlot[RandomReal[1,{10,20}]]

Use a standard blend as a color function:

ArrayPlot[RandomReal[1,{10,20}],ColorFunction->"Rainbow"]

OpenersExampleSection1(Spacer1)Scope  (7)

By default, absolute values go from white to black:

ArrayPlot[{{-1,0,1},{2,3,4}}]

Unknown or symbolic values are shown dark red:

ArrayPlot[{{-1,0,1},{2,3,x}}]

Plot data with units:

ArrayPlot[{{(QuantityUnit[0]),(QuantityUnit[3]),(QuantityUnit[2]),(QuantityUnit[9])},{(QuantityUnit[9]),(QuantityUnit[7]),(QuantityUnit[3]),(QuantityUnit[2])},{(QuantityUnit[8]),(QuantityUnit[8]),(QuantityUnit[9]),(QuantityUnit[3])}}]

Specify explicit colors for each cell:

ArrayPlot[RandomChoice[{Red,Green,Blue},{5,10}]]

Plot a ragged array, padding on the right:

ArrayPlot[{{1},{1,1},{1,0,1},{1,1,1,1}},Background->Cyan]

Cells with value (RefLink[None, paclet:ref/None]) are rendered like the background:

ArrayPlot[Table[If[x==y,None,1/(x-y)],{x,-2,2},{y,-2,2}],Background->Cyan]

Plot a sparse array:

ArrayPlot[SparseArray[{{x_,x_}->1,({x_,y_}/;Abs[x-y]<3)->.5},{10,10}],Mesh->True]

OpenersExampleSection2(Spacer1)Options  (59)

OpenersExampleSubsection0(Spacer1)AspectRatio  (2)

Make all cells square:

ArrayPlot[Mod[Array[Binomial,{32,32},0],2],AspectRatio->Automatic]

Use a different aspect ratio:

ArrayPlot[Mod[Array[Binomial,{32,32},0],2],AspectRatio->1/2]

OpenersExampleSubsection1(Spacer1)Background  (4)

(RefLink[Background, paclet:ref/Background]) is normally visible only around the edges:

ArrayPlot[{{1,0,0,0.3},{1,1,0,0.3},{1,0,1,0.7}},Background->Blue]

The background "shows through" whenever an explicit entry is (RefLink[None, paclet:ref/None]):

ArrayPlot[{{1,0,0,None},{1,1,0,None},{1,None,1,0.7}},Background->Blue]

(RefLink[Background, paclet:ref/Background]) also by default shows through for values outside the plot range:

ArrayPlot[{{1,0,0,0.3},{1,1,0,0.3},{1,0,1,0.7}},Background->Blue,PlotRange->{0.2,1}]

(RefLink[ClippingStyle, paclet:ref/ClippingStyle]) overrides background color:

ArrayPlot[{{1,0,0,0.3},{1,1,0,0.3},{1,0,1,0.7}},Background->Blue,PlotRange->{0.2,1},ClippingStyle->Red]

OpenersExampleSubsection2(Spacer1)ClippingStyle  (3)

The default is to show values outside the plot range in the background color:

ArrayPlot[Table[x+y,{x,-10,10},{y,-10,10}],PlotRange->{-10,10}]

Show values outside the plot range in red:

ArrayPlot[Table[x+y,{x,-10,10},{y,-10,10}],PlotRange->{-10,10},ClippingStyle->Red]

Show low values in blue and high values in red:

ArrayPlot[Table[x+y,{x,-10,10},{y,-10,10}],PlotRange->{-10,10},ClippingStyle->{Blue,Red}]

OpenersExampleSubsection3(Spacer1)ColorFunction  (5)

Map values from 0 to 1 onto colors according to (RefLink[Hue, paclet:ref/Hue]):

ArrayPlot[RandomReal[1,{10,20}],ColorFunction->Hue]

Use a pure function as the color function:

ArrayPlot[RandomReal[1,{10,20}],ColorFunction->(Hue[#^4/2]&)]

Use a named color gradient from (RefLink[ColorData, paclet:ref/ColorData]):

ArrayPlot[RandomReal[1,{10,20}],ColorFunction->"Pastel"]

Show elements with value 1 as black and all others as white:

ArrayPlot[Array[GCD,{20,20}],ColorFunction->(If[#==1,Black,White]&),ColorFunctionScaling->False]

With (RefLink[ColorFunctionScaling, paclet:ref/ColorFunctionScaling])->(RefLink[True, paclet:ref/True]), the values are first scaled to lie between 0 and 1:

ArrayPlot[Array[GCD,{20,20}],ColorFunction->Hue,ColorFunctionScaling->True]

OpenersExampleSubsection4(Spacer1)ColorRules  (6)

Specify color rules for explicit values or patterns:

ArrayPlot[Array[GCD,{20,20}],ColorRules->{1->Red,2->Blue,3->Yellow,_->Gray}]

(RefLink[ColorFunction, paclet:ref/ColorFunction]) is used if no color rules apply:

ArrayPlot[Array[GCD,{20,20}],ColorRules->{1->Red}]

The array can contain symbolic values:

ArrayPlot[Transpose[Permutations[{a,b,c}]],ColorRules->{a->Red,b->Yellow,c->Blue},Mesh->True]

Implement a "default color" by adding a rule for _:

ArrayPlot[{{1,0,1},{1,2,1},{1,0,3}},ColorRules->{1->Blue,0->Green,_->Black}]

Use any patterns in (RefLink[ColorRules, paclet:ref/ColorRules]):

ArrayPlot[{{-1,0,1},{2,3,-5},{1,2,1}},ColorRules->{_?EvenQ->Red,1|-1->Blue,x_/;x<-1->Black}]

Rules are used in the order given:

ArrayPlot[{{1,0,1},{1,1,0}},ColorRules->{1->Red,0->Blue,1->Black}]

OpenersExampleSubsection5(Spacer1)DataReversed  (4)

Reverse the order of rows:

ArrayPlot[CellularAutomaton[30,{{1},0},10],DataReversed->True]

The frame ticks give the original row numbers:

ArrayPlot[CellularAutomaton[30,{{1},0},10],FrameTicks->Automatic,DataReversed->True]

Reverse the order of rows and columns:

ArrayPlot[CellularAutomaton[30,{{1},0},10],FrameTicks->Automatic,DataReversed->{True,True}]

Reverse the order of columns:

ArrayPlot[CellularAutomaton[30,{{1},0},10],FrameTicks->Automatic,DataReversed->{False,True}]

OpenersExampleSubsection6(Spacer1)Epilog  (3)

Use (RefLink[Epilog, paclet:ref/Epilog]) to superimpose other graphics:

ArrayPlot[CellularAutomaton[30,{{1},0},10],Epilog->{Red,Disk[{4,4},3]}]

The graphics can be translucent:

ArrayPlot[CellularAutomaton[30,{{1},0},10],Epilog->{Opacity[.5],Red,Disk[{4,4},3]}]

(RefLink[Epilog, paclet:ref/Epilog]) uses the standard (RefLink[Graphics, paclet:ref/Graphics]) coordinate system:

ArrayPlot[CellularAutomaton[30,{{1},0},10],Epilog->{Red,Disk[{10.5,10.5},1]}]

OpenersExampleSubsection7(Spacer1)Frame  (1)

Do not use a frame:

ArrayPlot[Mod[Array[Binomial,{32,32},0],2],Frame->False]

OpenersExampleSubsection8(Spacer1)FrameTicks  (6)

Put frame ticks at round numbers:

ArrayPlot[Mod[Array[Binomial,{32,32},0],2],FrameTicks->Automatic]

Include frame ticks for endpoints:

ArrayPlot[Mod[Array[Binomial,{32,32},0],2],FrameTicks->All]

Frame ticks at specific values:

ArrayPlot[Mod[Array[Binomial,{32,32},0],2],FrameTicks->{{10,15,20,25},{12,24,48}}]

Frame ticks without a visible frame:

ArrayPlot[Mod[Array[Binomial,{8,8},0],2],FrameStyle->Opacity[0],FrameTicksStyle->Opacity[1],FrameTicks->All]

With a mesh included, (RefLink[Frame, paclet:ref/Frame])->(RefLink[True, paclet:ref/True]) is required for frame ticks to be drawn:

ArrayPlot[Mod[Array[Binomial,{8,8},0],2],Mesh->True,Frame->True,FrameTicks->All]

Make the frame invisible:

ArrayPlot[Mod[Array[Binomial,{8,8},0],2],Mesh->True,Frame->True,FrameStyle->Opacity[0],FrameTicksStyle->Opacity[1],FrameTicks->All]

OpenersExampleSubsection9(Spacer1)MaxPlotPoints  (1)

Use (RefLink[MaxPlotPoints, paclet:ref/MaxPlotPoints]) to limit the number of elements explicitly plotted in each direction:

ArrayPlot[CellularAutomaton[60,{{1},0},200]]

ArrayPlot[CellularAutomaton[60,{{1},0},200],MaxPlotPoints->50]

OpenersExampleSubsection10(Spacer1)Mesh  (5)

Insert mesh lines between all cells:

ArrayPlot[CellularAutomaton[30,{{1},0},10],Mesh->All]

Insert 15 row mesh lines and 5 column mesh lines:

ArrayPlot[CellularAutomaton[30,{{1},0},10],Mesh->{15,5}]

Insert mesh lines around the first 10 columns:

ArrayPlot[CellularAutomaton[30,{{1},0},10],Mesh->{None,Range[0,10]}]

Use a sequence of colors for the mesh lines:

ArrayPlot[CellularAutomaton[30,{{1},0},10],Mesh->{None,Table[{i,Hue[i/10]},{i,0,10}]}]

Insert mesh lines after the first and second rows:

ArrayPlot[CellularAutomaton[30,{{1},0},10],Mesh->{{1,2},None}]

OpenersExampleSubsection11(Spacer1)MeshStyle  (2)

Default mesh style:

ArrayPlot[RandomReal[1,{10,20}],Mesh->All]

Make the mesh pink:

ArrayPlot[RandomReal[1,{10,20}],Mesh->All,MeshStyle->Pink]

OpenersExampleSubsection12(Spacer1)PixelConstrained  (6)

Use (RefLink[PixelConstrained, paclet:ref/PixelConstrained])->(RefLink[True, paclet:ref/True]) to force cells to line up with screen pixels:

ArrayPlot[CellularAutomaton[30,{{1},0},100],PixelConstrained->True]

By default, cells do not necessarily line up exactly with screen pixels:

ArrayPlot[CellularAutomaton[30,{{1},0},100]]

Use exactly 1 pixel for each cell:

ArrayPlot[CellularAutomaton[30,{{1},0},100],PixelConstrained->1]

Use a 2×2 block of pixels for each cell:

ArrayPlot[CellularAutomaton[30,{{1},0},100],PixelConstrained->2]

Use a 1×2 block of pixels for each cell:

ArrayPlot[CellularAutomaton[30,{{1},0},100],PixelConstrained->{1,2}]

Pick the number of pixels per cell to be as large as possible in the given image size:

ArrayPlot[CellularAutomaton[30,{{1},0},100],PixelConstrained->True,ImageSize->Large]

OpenersExampleSubsection13(Spacer1)PlotLegends  (5)

No legend is used by default:

ArrayPlot[{{1,0,0,0.3},{1,1,0,0.3},{1,0,1,0.7}}]

Generate a legend automatically:

ArrayPlot[{{1,0,0,1},{1,1,0,1},{1,0,1,0}},PlotLegends->Automatic,ImageSize->100]

ArrayPlot[{{1,0,0,0.3},{1,1,0,0.3},{1,0,1,0.7}},PlotLegends->Automatic,ImageSize->100]

(RefLink[PlotLegends, paclet:ref/PlotLegends]) automatically picks up (RefLink[ColorFunction, paclet:ref/ColorFunction]):

Table[ArrayPlot[RandomReal[1,{10,20}],ColorFunction->cf,PlotLegends->Placed[Automatic,Below],ImageSize->100],{cf,{"Pastel",GrayLevel}}]

Legend uses (RefLink[ColorRules, paclet:ref/ColorRules]) as labels:

ArrayPlot[Transpose[Permutations[{a,b,c}]],ColorRules->{a->Red,b->Yellow,c->Blue},Mesh->True,PlotLegends->Automatic]

Use (RefLink[Placed, paclet:ref/Placed]) to place legend outside the plot:

Table[ArrayPlot[{{1,0,1},{1,1,0}},ColorRules->{1->Red,0->Blue},PlotLegends->Placed[Automatic,pl]],{pl,{After,Before}}]

Table[ArrayPlot[{{1,0,1},{1,1,0}},ColorRules->{1->Red,0->Blue},PlotLegends->Placed[Automatic,pl]],{pl,{Above,Below}}]

OpenersExampleSubsection14(Spacer1)PlotRange  (5)

Plot all elements:

ArrayPlot[Array[GCD,{10,10}]]

Plot only elements with values up to 3, leaving the rest white:

ArrayPlot[Array[GCD,{10,10}],PlotRange->3]

The first two entries in (RefLink[PlotRange, paclet:ref/PlotRange]) specify the range of rows and columns to include:

ArrayPlot[Array[GCD,{10,10}],PlotRange->{{2,6},All,3}]

With specific plot range {(Subscript[a, min]),(Subscript[a, max])}, the colors range from white at (Subscript[a, min]) to black at (Subscript[a, max]):

{ArrayPlot[{{0,1},{1,2}},PlotRange->{-2,2}],ArrayPlot[{{0,1},{1,2}},PlotRange->{0,2}]}

Plot positive elements only:

ArrayPlot[RandomReal[{-10,10},{10,20}],PlotRange->{0,All}]

OpenersExampleSubsection15(Spacer1)PlotTheme  (1)

Use a theme with detailed ticks and a legend:

ArrayPlot[RandomReal[{-10,10},{20,20}],PlotTheme->"Detailed"]

Move the legend below the plot:

ArrayPlot[RandomReal[{-10,10},{20,20}],PlotTheme->"Detailed",PlotLegends->Placed[Automatic,Below]]

OpenersExampleSection3(Spacer1)Applications  (11)

Plot a two-color cellular automaton evolution:

ArrayPlot[CellularAutomaton[30,{{1},0},50]]

Plot a three-color cellular automaton evolution:

ArrayPlot[CellularAutomaton[{1635,{3,1}},{{1},0},80]]

Use colors rather than gray levels:

ArrayPlot[CellularAutomaton[{1635,{3,1}},{{1},0},80],ColorRules->{0->Black,1->Red,2->Yellow}]

Plot the imaginary parts of a discrete Fourier transform matrix:

ArrayPlot[Im[Table[Exp[2. Pi I i j/32],{i,0,32},{j,0,32}]]]

Plot the inverse of a matrix, shading according to absolute value:

ArrayPlot[Inverse[Table[(1+Mod[i j,19])/(i+j),{i,20},{j,20}]]]

Show positive entries as black and others as white:

ArrayPlot[Inverse[Table[(1+Mod[i j,19])/(i+j),{i,20},{j,20}]],ColorFunction->(If[#>0,Black,White]&),ColorFunctionScaling->False]

Create a list of array plots:

Table[ArrayPlot[Table[Mod[Binomial[i,j],n],{i,30},{j,30}]],{n,2,5}]

Plot a table of values of five sine waves in random directions:

ArrayPlot[Table[Evaluate[Sum[Sin[RandomReal[10,2].{x,y}],{5}]],{x,0,5,.1},{y,0,5,.1}]]

Plot image-processed data:

ArrayPlot[ListConvolve[{{1,1,1},{1,1,1},{1,1,1}},CellularAutomaton[30,{{1},0},50]]]

Plot a color map:

ArrayPlot[{Range[0,1,.01]},AspectRatio->1/4,ColorFunction->Hue]

Use a special color for non-numeric data:

ArrayPlot[Table[1/(x^2+y^2),{x,-5,5},{y,-5,5}],ColorRules->{ComplexInfinity->Red}]

Digits of powers of 3 in base 2:

ArrayPlot[PadLeft[Table[IntegerDigits[3^n,2],{n,70}]]]

Plot a sparse matrix in black and white:

data=Import[FileNameJoin[{"LinearAlgebraExamples","Data","west0381.mtx"}]];

ArrayPlot[data,ColorFunction->"Monochrome"]

OpenersExampleSection4(Spacer1)Properties & Relations  (7)

An empty array yields a blank picture:

ArrayPlot[{{}}]

(RefLink[Grid, paclet:ref/Grid]) arranges elements the same way as (RefLink[ArrayPlot, paclet:ref/ArrayPlot]):

ArrayPlot[{{1,0,0,0},{1,0.5,1,1},{1,0,0.3,1}}]

Grid[{{1,0,0,0},{1,0.5,1,1},{1,0,0.3,1}}]

(RefLink[Raster, paclet:ref/Raster]) arranges elements upside down and with colors reversed relative to (RefLink[ArrayPlot, paclet:ref/ArrayPlot]):

{ArrayPlot[{{0,1},{2,3}}],Graphics[Raster[{{0,1},{2,3}}/3]]}

Make the array be shown the same way as in (RefLink[ArrayPlot, paclet:ref/ArrayPlot]):

Graphics[Raster[Reverse[1-{{0,1},{2,3}}/3]]]

Use (RefLink[MatrixPlot, paclet:ref/MatrixPlot]) when entries have a big range and many different values:

MatrixPlot[Fourier[Table[UnitStep[i,4-i] UnitStep[j,7-j],{i,-50,50},{j,-50,50}]]]

Or for large sparse matrices:

ExampleData[{"Matrix","WEST2021"},"Matrix"]

MatrixPlot[%]

Use (RefLink[ReliefPlot, paclet:ref/ReliefPlot]) for medical and geographic data:

ReliefPlot[Import["http://exampledata.wolfram.com/hailey.dem.gz","Data"],ColorFunction->"GreenBrownTerrain", MaxPlotPoints -> 200]

Use (RefLink[ListDensityPlot, paclet:ref/ListDensityPlot]) for structured or unstructured data sampled from continuous densities:

ListDensityPlot[Table[x+Sin[3x+y^2],{x,-3,3,0.1},{y,-3,3,0.1}],ColorFunction->"SunsetColors"]

Use (RefLink[GraphPlot, paclet:ref/GraphPlot]) for visualizing adjacency matrices:

GraphPlot[RandomChoice[{0.01,0.99}->{1,0},{100,100}]]

OpenersExampleSection5(Spacer1)Possible Issues  (2)

(RefLink[ArrayPlot, paclet:ref/ArrayPlot]) may not be able to distinguish between large numbers of different values:

data=HankelMatrix[Table[(-1)^i/i,{i,25}]];

ArrayPlot[data]

Use (RefLink[MatrixPlot, paclet:ref/MatrixPlot]) instead (or provide a custom (RefLink[ColorFunction, paclet:ref/ColorFunction])):

MatrixPlot[data,FrameTicks->None]

Entries of very small relative absolute values may not be differentiable from zero:

ArrayPlot[{{10000,1,-1,0}}]

(RefLink[MatrixPlot, paclet:ref/MatrixPlot]) scales entries so that entries with small relative absolute values can still be seen:

MatrixPlot[{{10000,1,-1,0}}]

OpenersExampleSection6(Spacer1)Neat Examples  (2)

Plot the (RefLink[Sin, paclet:ref/Sin]) function at integer points:

ArrayPlot[Table[Sin[x y],{x,-40,40},{y,-40,40}]]

Manipulate[ArrayPlot[Array[GCD,{50,50}],ColorFunction->(Hue[Mod[#+a,1]]&),ColorFunctionScaling->True],{a,0,1}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[MatrixPlot, paclet:ref/MatrixPlot])  ▪  (RefLink[ReliefPlot, paclet:ref/ReliefPlot])  ▪  (RefLink[ListDensityPlot, paclet:ref/ListDensityPlot])  ▪  (RefLink[DensityPlot, paclet:ref/DensityPlot])  ▪  (RefLink[Raster, paclet:ref/Raster])  ▪  (RefLink[ListPlot3D, paclet:ref/ListPlot3D])  ▪  (RefLink[Grid, paclet:ref/Grid])  ▪  (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid])  ▪  (RefLink[SparseArray, paclet:ref/SparseArray])  ▪  (RefLink[CellularAutomaton, paclet:ref/CellularAutomaton])  ▪  (RefLink[PadLeft, paclet:ref/PadLeft])  ▪  (RefLink[ArrayFlatten, paclet:ref/ArrayFlatten])  ▪  (RefLink[GraphPlot, paclet:ref/GraphPlot])  ▪  (RefLink[ClickPane, paclet:ref/ClickPane])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Data Visualization, paclet:guide/DataVisualization])}, {▪(RefLinkPlain[Computational Systems, paclet:guide/ComputationalSystemsAndDiscovery])}, {▪(RefLinkPlain[Handling Arrays of Data, paclet:guide/HandlingArraysOfData])}, {▪(RefLinkPlain[Charting and Information Visualization, paclet:guide/ChartingAndInformationVisualization])}, {▪(RefLinkPlain[Scientific Data Analysis, paclet:guide/ScientificDataAnalysis])}, {▪(RefLinkPlain[Function Visualization, paclet:guide/FunctionVisualization])}, {▪(RefLinkPlain[Numerical Data, paclet:guide/NumericalData])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/13-arrays-or-lists-of-lists.html])(WebLink[: Arrays, or Lists of Lists, https://www.wolfram.com/language/elementary-introduction/13-arrays-or-lists-of-lists.html])}})}})