GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing reference.wolfram.com — ArrayPlot: Visualize a 2D sparse array using grayscale or other color maps—Wolfram Documentation ArrayPlot[array] generates a plot in which the values in an array are shown in a discrete array of squares. Details and Options
Examples
Basic Examples
Scope
Options
AspectRatio
Axes
AxesLabel
AxesOrigin
AxesStyle
Background
ClippingStyle
ColorFunction
ColorRules
DataReversed
Epilog
Frame
FrameLabel
FrameStyle
FrameTicks
FrameTicksStyle
GridLines
ImageSize
MaxPlotPoints
Mesh
MeshStyle
PlotLegends
PlotRange
PlotTheme
Applications
Properties & Relations
Possible Issues
Neat Examples
See Also
Related Guides
Related Links
History
Cite this Page
ArrayPlotArrayPlot[array] generates a plot in which the values in an array are shown in a discrete array of squares. Details and Options
List of all optionsExamplesopen all close allBasic 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"]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[{{Quantity[0, "Meters"], Quantity[3, "Meters"], Quantity[2, "Meters"], Quantity[9, "Meters"]}, {Quantity[9, "Meters"], Quantity[7, "Meters"], Quantity[3, "Meters"], Quantity[2, "Meters"]}, {Quantity[8, "Meters"], Quantity[8, "Meters"], Quantity[9, "Meters"], Quantity[3, "Meters"]}}]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 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]Options (96)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]Axes (4)By default, ArrayPlot uses a frame instead of axes: ArrayPlot[RandomReal[1, {10, 20}]]Use axes instead of a frame: ArrayPlot[RandomReal[1, {10, 20}], Frame -> False, Axes -> True]Use AxesOrigin to specify where the axes intersect: ArrayPlot[RandomReal[1, {10, 20}], Frame -> False, Axes -> True, AxesOrigin -> {-1, -1}]Turn each axis on individually: {ArrayPlot[RandomReal[1, {10, 20}], Frame -> False, Axes -> {True, False}], ArrayPlot[RandomReal[1, {10, 20}], Frame -> False, Axes -> {False, True}]}AxesLabel (3)No axes labels are drawn by default: ArrayPlot[CellularAutomaton[20, {{1}, 0}, 10], Frame -> False, Axes -> True]Place a label on the ArrayPlot[CellularAutomaton[20, {{1}, 0}, 10], Frame -> False, Axes -> True, AxesLabel -> "Y"]Specify axes labels: ArrayPlot[CellularAutomaton[20, {{1}, 0}, 10], Frame -> False, Axes -> True, AxesLabel -> {"axis 1", "axes 2"}]AxesOrigin (2)The position of the axes is determined automatically: ArrayPlot[CellularAutomaton[30, {{1}, 0}, 10], Frame -> False, Axes -> True]Specify an explicit origin for the axes: ArrayPlot[CellularAutomaton[30, {{1}, 0}, 10], Frame -> False, Axes -> True, AxesOrigin -> {5, 2}]AxesStyle (4)Change the style for the axes: ArrayPlot[CellularAutomaton[30, {{1}, 0}, 10], Frame -> False, Axes -> True, AxesStyle -> Red]Specify the style of each axis: ArrayPlot[CellularAutomaton[30, {{1}, 0}, 10], Frame -> False, Axes -> True, AxesStyle -> {Directive[Thick, Red], Directive[Thick, Blue]}]Use different styles for the ticks and the axes: ArrayPlot[CellularAutomaton[30, {{1}, 0}, 10], Frame -> False, Axes -> True, AxesStyle -> Red, TicksStyle -> Blue]Use different styles for the labels and the axes: ArrayPlot[CellularAutomaton[30, {{1}, 0}, 10], Frame -> False, Axes -> True, AxesStyle -> Red, LabelStyle -> Blue]Background (4)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 None: ArrayPlot[{{1, 0, 0, None}, {1, 1, 0, None}, {1, None, 1, 0.7}}, Background -> Blue]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}]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]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}]ColorFunction (5)Map values from 0 to 1 onto colors according to 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 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 ColorFunctionScaling->True, the values are first scaled to lie between 0 and 1: ArrayPlot[Array[GCD, {20, 20}], ColorFunction -> Hue, ColorFunctionScaling -> True]ColorRules (6)Specify color rules for explicit values or patterns: ArrayPlot[Array[GCD, {20, 20}], ColorRules -> {1 -> Red, 2 -> Blue, 3 -> Yellow, _ -> Gray}]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 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}]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}]Epilog (3)Use 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]}]Epilog uses the standard Graphics coordinate system: ArrayPlot[CellularAutomaton[30, {{1}, 0}, 10], Epilog -> {Red, Disk[{10.5, 10.5}, 1]}]Frame (4)ArrayPlot uses a frame by default: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]]]Use FrameFalse to turn off the frame: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], Frame -> False]Draw a frame on the left and right edges: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], Frame -> {{True, True}, {False, False}}]Draw a frame on the left and bottom edges: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], Frame -> {{True, False}, {True, False}}]FrameLabel (3)Place a label along the bottom frame of a plot: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameLabel -> {{"Bottom", None}, {None, None}}]Place labels on each of the edges in the frame: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameLabel -> {{"Bottom", "Top"}, {"Left", "Right"}}]Use a customized style for both labels and frame tick labels: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameLabel -> {{"Bottom", "Top"}, {"Left", "Right"}}, LabelStyle -> Directive[Bold, StandardOrange]]FrameStyle (2)Specify the style of the frame: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameStyle -> Directive[StandardOrange, Thick]]Specify style for each frame edge: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameStyle -> {{Directive[Green, Thick], Directive[Red]}, {Directive[Orange, Thick], Directive[Blue]}}]FrameTicks (13)Frame ticks are not included by default: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]]]Use frame ticks on the bottom edge: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicks -> {{None, None}, {Automatic, None}}]By default, none of the edges have either tick marks or tick labels: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]]]Use automatic tick placements to include tick labels on all edges: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicks -> Automatic]Use FrameTicksAll to include tick labels on all edges: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicks -> All]Place tick marks at specific positions: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicks -> {{{10, 20, 30}, {10, 20, 30}}, {{10, 15, 30}, {10, 15, 30}}}]Draw frame tick marks at the specified positions with specific labels: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicks -> {{{{10, a}, {20, b}, {30, c}}, None}, {{{10, a}, {15, d}, {30, c}}, None}}]Specify the lengths for tick marks as a fraction of the graphics size: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicksStyle -> Red, FrameTicks -> {{{{10, a, .2}, {20, b, .2}, {30, c, .2}}, None}, {{{10, a, .2}, {15, d, Automatic}, {30, c, .2}}, None}}]Use different sizes in the positive and negative directions for each tick mark: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicksStyle -> Red, FrameTicks -> {{{{10, a, {.2, .05}}, {20, b, {.2, .2}}, {30, c, {.2, .1}}}, None}, {None, None}}]Specify a style for each frame tick: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicks -> {{{{10, a, .5, Directive[Thick, Blue]}, {20, b, .35, Directive[Thick, Green]}, {30, c, .4, Directive[Thick, Yellow, Dashed]}}, Automatic}, {Automatic, Automatic}}]Construct a function that places frame ticks at the midpoint and extremes of the frame edge: minMeanMax[min_, max_] := {{min, min}, {(max + min) / 2, (max + min) / 2}, {max, max}}ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicks -> {{minMeanMax, None}, {minMeanMax, None}}, PlotRangePadding -> None]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, Frame->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]FrameTicksStyle (3)By default, the frame ticks and frame tick labels use the same styles as the frame: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameStyle -> Directive[Red], FrameTicks -> Automatic]Specify an overall style for the ticks, including the labels: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicksStyle -> Directive[Red, Thick], FrameTicks -> Automatic]Use a different style for the different frame edges: ArrayPlot[Im[Table[Exp[2. Pi I i j / 32], {i, 0, 32}, {j, 0, 32}]], FrameTicks -> True, FrameTicksStyle -> {{Directive[Magenta, Thick], Blue}, {Red, Darker@Green}}, FrameTicks -> Automatic]GridLines (3)Draw grids across the plot: ArrayPlot[RandomInteger[1, {5, 5}], GridLines -> Automatic]Draw grid lines at specified positions: ArrayPlot[RandomInteger[1, {5, 5}], GridLines -> {{1, 2.5, 4}, {1, 2.5, 4}}]Specify grid styles: ArrayPlot[RandomInteger[1, {5, 5}], GridLines -> Automatic, GridLinesStyle -> Directive[Orange, Dashed]]ImageSize (7)Use named sizes such as Tiny, Small, Medium and Large: {ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], ImageSize -> Tiny], ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], ImageSize -> Small]}Specify the width of the plot: {ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], ImageSize -> 150], ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], AspectRatio -> 1.5, ImageSize -> 150]}Specify the height of the plot: {ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], ImageSize -> {Automatic, 200}], ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], AspectRatio -> 2, ImageSize -> {Automatic, 200}]}Allow the width and height to be up to a certain size: {ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], ImageSize -> UpTo[200]], ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], AspectRatio -> 2, ImageSize -> UpTo[200]]}Specify the width and height for a graphic, padding with space if necessary: ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], ImageSize -> {200, 200}]Setting AspectRatioFull will fill the available space: ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], AspectRatio -> Full, ImageSize -> {200, 200}]Use maximum sizes for the width and height: {ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], ImageSize -> {UpTo[100], UpTo[150]}], ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], AspectRatio -> 2, ImageSize -> {UpTo[100], UpTo[200]}]}Use ImageSizeFull to fill the available space in an object: Framed[Pane[ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], ImageSize -> Full], {150, 150}]]Specify the image size as a fraction of the available space: Framed[Pane[ArrayPlot[Mod[Array[Binomial, {32, 32}, 0], 2], AspectRatio -> Full, ImageSize -> {Scaled[0.5], Scaled[0.5]}], {200, 100}]]MaxPlotPoints (1)Use 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]Mesh (7)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}]Use MeshAutomatic to draw mesh for the data in a ragged array: ArrayPlot[Table[If[i < j, 0, 1], {j, 20}, {i, 2j}], Mesh -> Automatic]Use Mesh"Nonzero" to draw mesh lines around nonzero cells: ArrayPlot[Table[If[i < j, 0, 1], {j, 20}, {i, 2j}], Mesh -> "Nonzero"]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]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]PlotLegends automatically picks up ColorFunction: Table[ArrayPlot[RandomReal[1, {10, 20}], ColorFunction -> cf, PlotLegends -> Placed[Automatic, Below], ImageSize -> 100], {cf, {"Pastel", GrayLevel}}]Legend uses ColorRules as labels: ArrayPlot[Transpose[Permutations[{a, b, c}]], ColorRules -> {a -> Red, b -> Yellow, c -> Blue}, Mesh -> True, PlotLegends -> Automatic]Use 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}}]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 PlotRange specify the range of rows and columns to include: ArrayPlot[Array[GCD, {10, 10}], PlotRange -> {{2, 6}, All, 3}]With specific plot range {amin,amax}, the colors range from white at amin to black at amax: {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}]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]]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 Vandermonde matrix for a discrete Fourier transform: ArrayPlot[Im[
Inverse[FourierMatrix[25, WorkingPrecision -> MachinePrecision]]], ColorFunction -> "TemperatureMap"]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}]], ColorFunction -> "DeepSeaColors"]Show positive entries as gray and others as yellow: ArrayPlot[Inverse[Table[(1 + Mod[i j, 19]) / (i + j), {i, 20}, {j, 20}]], ColorFunction -> (If[# > 0, Yellow, Gray]&), 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"]Properties & Relations (8)An empty array yields a blank picture: ArrayPlot[{{}}]Grid arranges elements the same way as 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}}]Raster arranges elements upside down and with colors reversed relative to ArrayPlot: {ArrayPlot[{{0, 1}, {2, 3}}], Graphics[Raster[{{0, 1}, {2, 3}} / 3]]}Make the array be shown the same way as in ArrayPlot: Graphics[Raster[Reverse[1 - {{0, 1}, {2, 3}} / 3]]]Use ArrayPlot3D for 3D arrays of data: ArrayPlot3D[RandomInteger[5, {3, 4, 5}]]Use 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 ReliefPlot for medical and geographic data: ReliefPlot[Import["http://exampledata.wolfram.com/hailey.dem.gz", "Data"], ColorFunction -> "GreenBrownTerrain", MaxPlotPoints -> 200]Use 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"]ArrayPlot[Reverse[Table[x + Sin[3x + y ^ 2], {x, -3, 3, 0.05}, {y, -3, 3, 0.05}]], ColorFunction -> "SunsetColors"]Use GraphPlot for visualizing adjacency matrices: GraphPlot[RandomChoice[{0.01, 0.99} -> {1, 0}, {100, 100}]]Possible Issues (2)ArrayPlot may not be able to distinguish between large numbers of different values: data = HankelMatrix[Table[(-1) ^ i / i, {i, 25}]];ArrayPlot[data]Use MatrixPlot instead (or provide a custom ColorFunction): MatrixPlot[data, FrameTicks -> None]Entries of very small relative absolute values may not be differentiable from zero: ArrayPlot[{{10000, 1, -1, 0}}]MatrixPlot scales entries so that entries with small relative absolute values can still be seen: MatrixPlot[{{10000, 1, -1, 0}}]Neat Examples (2)Plot the Sin function at integer points: ArrayPlot[Table[Sin[x y], {x, -40, 40}, {y, -40, 40}]]Interactively map GCD values onto colors using Hue: Manipulate[ArrayPlot[Array[GCD, {50, 50}], ColorFunction -> (Hue[Mod[# + a, 1]]&), ColorFunctionScaling -> True], {a, 0, 1}]HistoryIntroduced in 2004 (5.1) | Updated in 2007 (6.0) ▪ 2012 (9.0) ▪ 2014 (10.0) ▪ 2020 (12.1) ▪ 2021 (12.3) ▪ 2025 (14.3)
Wolfram Research (2004), ArrayPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/ArrayPlot.html (updated 2025).
TextWolfram Research (2004), ArrayPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/ArrayPlot.html (updated 2025). CMSWolfram Language. 2004. "ArrayPlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/ArrayPlot.html. APAWolfram Language. (2004). ArrayPlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ArrayPlot.html BibTeX@misc{reference.wolfram_2026_arrayplot, author="Wolfram Research", title="{ArrayPlot}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/ArrayPlot.html}", note=[Accessed: 12-November-2026]} BibLaTeX@online{reference.wolfram_2026_arrayplot, organization={Wolfram Research}, title={ArrayPlot}, year={2025}, url={https://reference.wolfram.com/language/ref/ArrayPlot.html}, note=[Accessed: 12-November-2026]} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |