ArrayPlot
✖
ArrayPlot
generates a plot in which the values in an array are shown in a discrete array of squares.
Details and Options




- 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.
- 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 PlotRange, 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: »
-
None background color color directive specified color - If array is ragged, shorter rows are treated as padded on the right with background. »
- ArrayPlot has the same options as Graphics, with the following additions and changes: [List of all options]
-
AspectRatio Automatic ratio of height to width ClippingStyle None how to show cells whose values are clipped ColorFunction Automatic how each cell should be colored ColorFunctionScaling True whether to scale the argument to ColorFunction ColorRules Automatic rules for determining colors from values DataRange All the range of and
values to assume
DataReversed False whether to reverse the order of rows Frame Automatic whether to draw a frame around the plot FrameLabel None labels for rows and columns FrameTicks None what ticks to include on the frame MaxPlotPoints Infinity the maximum number of points to include Mesh False whether to draw a mesh MeshStyle GrayLevel[GoldenRatio-1] the style to use for a mesh PlotLegends None legends for datasets PlotRange All the range of values to plot PlotTheme $PlotTheme overall theme for the plot TargetUnits Automatic units to display in the plot - The rules given by ColorRules are applied to the value
of each cell. The rules can involve patterns. »
- If none of the rules in ColorRules apply, then ColorFunction is used to determine the color.
- With the default setting ColorRules->Automatic, an explicit setting ColorFunction->f is used instead of ColorRules.
- With ColorFunctionScaling->False, each value
is supplied as the argument to any function given for ColorFunction. »
- With ColorFunctionScaling->True, the values are scaled to lie between 0 and 1. »
- If the color determined for a particular cell is 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 DataReversed->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 FrameTicks->Automatic, ticks are placed at round integers, typically multiples of 5 or 10.
- With the setting FrameTicks->All, ticks are also placed at the minimum and maximum
and
.
- In explicit FrameTicks specifications, the tick coordinates are taken to refer to
and
.
- With DataReversed->True, tick values decrease from top to bottom.
- PlotRange->amax specifies that only those
between 0 and amax should be shown. »
- PlotRange->{amin,amax} specifies that
between amin and amax should be shown.
- PlotRange->{{imin,imax},{jmin,jmax}} shows only elements with
and
in the specified ranges. The top‐left element has
,
. With the default setting DataReversed->False,
increases down the page;
increases to the right.
- PlotRange->{ispec,jspec,aspec} shows only elements in the specified ranges of
,
, and value. »
- With the default setting for ColorFunction, PlotRange->{amin,amax} specifies that values from amin to amax should be shown with gray scales varying from white to black.
- Possible settings for Mesh include:
-
False do not draw any mesh lines True draw mesh lines between all cells Automatic draw mesh lines around original cells only "Nonzero" draw mesh lines around nonzero cells {mi,mj} use mesh specifications for the i and j directions - With the default setting Frame->Automatic, a frame is drawn only when Mesh->False.
- For purposes of combining with other graphics, the array element
is taken to cover a unit square centered at coordinate position
,
.
- A setting DataRange->{{xmin,xmax},{ymin,ymax}} specifies that the centers of successive cells should be at equally spaced positions between xmin and xmax in the horizontal direction, and ymin and ymax in the vertical direction. With the default setting DataReversed->False,
is centered at {xmin,ymax}.
- With the default setting DataRange->All and DataReversed->False, the array element
will be taken to cover a unit square centered at coordinate position
,
.
- ArrayPlot returns Graphics[Raster[data],opts].
- ArrayPlot works with SparseArray objects. »
-
AlignmentPoint Center the default point in the graphic to align with AspectRatio Automatic ratio of height to width Axes False whether to draw axes AxesLabel None axes labels AxesOrigin Automatic where axes should cross AxesStyle {} style specifications for the axes Background None background color for the plot BaselinePosition Automatic how to align with a surrounding text baseline BaseStyle {} base style specifications for the graphic ClippingStyle None how to show cells whose values are clipped ColorFunction Automatic how each cell should be colored ColorFunctionScaling True whether to scale the argument to ColorFunction ColorRules Automatic rules for determining colors from values ContentSelectable Automatic whether to allow contents to be selected CoordinatesToolOptions Automatic detailed behavior of the coordinates tool DataRange All the range of and
values to assume
DataReversed False whether to reverse the order of rows Epilog {} primitives rendered after the main plot FormatType TraditionalForm the default format type for text Frame Automatic whether to draw a frame around the plot FrameLabel None labels for rows and columns FrameStyle {} style specifications for the frame FrameTicks None what ticks to include on the frame FrameTicksStyle {} style specifications for frame ticks GridLines None grid lines to draw GridLinesStyle {} style specifications for grid lines ImageMargins 0. the margins to leave around the graphic ImagePadding All what extra padding to allow for labels etc. ImageSize Automatic the absolute size at which to render the graphic LabelStyle {} style specifications for labels MaxPlotPoints Infinity the maximum number of points to include Mesh False whether to draw a mesh MeshStyle GrayLevel[GoldenRatio-1] the style to use for a mesh Method Automatic details of graphics methods to use PlotLabel None an overall label for the plot PlotLegends None legends for datasets PlotRange All the range of values to plot PlotRangeClipping False whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotRegion Automatic the final display region to be filled PlotTheme $PlotTheme overall theme for the plot PreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic Prolog {} primitives rendered before the main plot RotateLabel True whether to rotate y labels on the frame TargetUnits Automatic units to display in the plot Ticks Automatic axes ticks TicksStyle {} style specifications for axes ticks
List of all options



Examples
open allclose allBasic Examples (6)Summary of the most common use cases

https://wolfram.com/xid/0cqzvyzm-vjk

Give explicit color directives to specify colors for individual cells:

https://wolfram.com/xid/0cqzvyzm-x0p


https://wolfram.com/xid/0cqzvyzm-fw2


https://wolfram.com/xid/0cqzvyzm-h1e


https://wolfram.com/xid/0cqzvyzm-gt5

Use a standard blend as a color function:

https://wolfram.com/xid/0cqzvyzm-63dqy

Scope (7)Survey of the scope of standard use cases
By default, absolute values go from white to black:

https://wolfram.com/xid/0cqzvyzm-xm4

Unknown or symbolic values are shown dark red:

https://wolfram.com/xid/0cqzvyzm-t65


https://wolfram.com/xid/0cqzvyzm-bdfftn

Specify explicit colors for each cell:

https://wolfram.com/xid/0cqzvyzm-dcj

Plot a ragged array, padding on the right:

https://wolfram.com/xid/0cqzvyzm-bkf

Cells with value None are rendered like the background:

https://wolfram.com/xid/0cqzvyzm-swe


https://wolfram.com/xid/0cqzvyzm-k23

Options (96)Common values & functionality for each option
AspectRatio (2)
Axes (4)
By default, ArrayPlot uses a frame instead of axes:

https://wolfram.com/xid/0cqzvyzm-k6ktb8


https://wolfram.com/xid/0cqzvyzm-nsoxe

Use AxesOrigin to specify where the axes intersect:

https://wolfram.com/xid/0cqzvyzm-bvjwfk

Turn each axis on individually:

https://wolfram.com/xid/0cqzvyzm-jc2a91

AxesLabel (3)
AxesOrigin (2)
AxesStyle (4)
Change the style for the axes:

https://wolfram.com/xid/0cqzvyzm-hy353s

Specify the style of each axis:

https://wolfram.com/xid/0cqzvyzm-heu1ws

Use different styles for the ticks and the axes:

https://wolfram.com/xid/0cqzvyzm-j3xukb

Use different styles for the labels and the axes:

https://wolfram.com/xid/0cqzvyzm-fxwm3s

Background (4)
Background is normally visible only around the edges:

https://wolfram.com/xid/0cqzvyzm-e3n

The background "shows through" whenever an explicit entry is None:

https://wolfram.com/xid/0cqzvyzm-sro

Background also by default shows through for values outside the plot range:

https://wolfram.com/xid/0cqzvyzm-bl3

ClippingStyle overrides background color:

https://wolfram.com/xid/0cqzvyzm-mpy

ClippingStyle (3)
The default is to show values outside the plot range in the background color:

https://wolfram.com/xid/0cqzvyzm-s7v

Show values outside the plot range in red:

https://wolfram.com/xid/0cqzvyzm-fou

Show low values in blue and high values in red:

https://wolfram.com/xid/0cqzvyzm-yyt

ColorFunction (5)
Map values from 0 to 1 onto colors according to Hue:

https://wolfram.com/xid/0cqzvyzm-bgq

Use a pure function as the color function:

https://wolfram.com/xid/0cqzvyzm-u24

Use a named color gradient from ColorData:

https://wolfram.com/xid/0cqzvyzm-e94xrd

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

https://wolfram.com/xid/0cqzvyzm-imx

With ColorFunctionScaling->True, the values are first scaled to lie between 0 and 1:

https://wolfram.com/xid/0cqzvyzm-koi

ColorRules (6)
Specify color rules for explicit values or patterns:

https://wolfram.com/xid/0cqzvyzm-imy

ColorFunction is used if no color rules apply:

https://wolfram.com/xid/0cqzvyzm-cd6

The array can contain symbolic values:

https://wolfram.com/xid/0cqzvyzm-t3w

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

https://wolfram.com/xid/0cqzvyzm-qux

Use any patterns in ColorRules:

https://wolfram.com/xid/0cqzvyzm-otf

Rules are used in the order given:

https://wolfram.com/xid/0cqzvyzm-qid

DataReversed (4)

https://wolfram.com/xid/0cqzvyzm-jlv

The frame ticks give the original row numbers:

https://wolfram.com/xid/0cqzvyzm-l1k

Reverse the order of rows and columns:

https://wolfram.com/xid/0cqzvyzm-u2caao


https://wolfram.com/xid/0cqzvyzm-f3cnvq

Epilog (3)
Frame (4)
ArrayPlot uses a frame by default:

https://wolfram.com/xid/0cqzvyzm-x8av6u

Use FrameFalse to turn off the frame:

https://wolfram.com/xid/0cqzvyzm-fo41ir

Draw a frame on the left and right edges:

https://wolfram.com/xid/0cqzvyzm-gwiq7p

Draw a frame on the left and bottom edges:

https://wolfram.com/xid/0cqzvyzm-wfrn9h

FrameLabel (3)
Place a label along the bottom frame of a plot:

https://wolfram.com/xid/0cqzvyzm-32lsj9

Place labels on each of the edges in the frame:

https://wolfram.com/xid/0cqzvyzm-694ny7

Use a customized style for both labels and frame tick labels:

https://wolfram.com/xid/0cqzvyzm-sbnsp4

FrameStyle (2)
FrameTicks (13)
Frame ticks are not included by default:

https://wolfram.com/xid/0cqzvyzm-w90ex3

Use frame ticks on the bottom edge:

https://wolfram.com/xid/0cqzvyzm-2p6tdc

By default, none of the edges have either tick marks or tick labels:

https://wolfram.com/xid/0cqzvyzm-0qcuvc

Use automatic tick placements to include tick labels on all edges:

https://wolfram.com/xid/0cqzvyzm-3el3xp

Use FrameTicksAll to include tick labels on all edges:

https://wolfram.com/xid/0cqzvyzm-mu4gnh

Place tick marks at specific positions:

https://wolfram.com/xid/0cqzvyzm-8d7os7

Draw frame tick marks at the specified positions with specific labels:

https://wolfram.com/xid/0cqzvyzm-5wmadd

Specify the lengths for tick marks as a fraction of the graphics size:

https://wolfram.com/xid/0cqzvyzm-wy2m9m

Use different sizes in the positive and negative directions for each tick mark:

https://wolfram.com/xid/0cqzvyzm-zpqrp2

Specify a style for each frame tick:

https://wolfram.com/xid/0cqzvyzm-ynsayf

Construct a function that places frame ticks at the midpoint and extremes of the frame edge:

https://wolfram.com/xid/0cqzvyzm-xa0mha

https://wolfram.com/xid/0cqzvyzm-6m5xes

Frame ticks without a visible frame:

https://wolfram.com/xid/0cqzvyzm-ybp

With a mesh included, Frame->True is required for frame ticks to be drawn:

https://wolfram.com/xid/0cqzvyzm-eu9


https://wolfram.com/xid/0cqzvyzm-lti

FrameTicksStyle (3)
By default, the frame ticks and frame tick labels use the same styles as the frame:

https://wolfram.com/xid/0cqzvyzm-1en17w

Specify an overall style for the ticks, including the labels:

https://wolfram.com/xid/0cqzvyzm-dezgw9

Use a different style for the different frame edges:

https://wolfram.com/xid/0cqzvyzm-9qm9ev

GridLines (3)
ImageSize (7)
Use named sizes such as Tiny, Small, Medium and Large:

https://wolfram.com/xid/0cqzvyzm-f4plzp

Specify the width of the plot:

https://wolfram.com/xid/0cqzvyzm-liypoh

Specify the height of the plot:

https://wolfram.com/xid/0cqzvyzm-ibq7vw

Allow the width and height to be up to a certain size:

https://wolfram.com/xid/0cqzvyzm-i57sle

Specify the width and height for a graphic, padding with space if necessary:

https://wolfram.com/xid/0cqzvyzm-ceslzh

Setting AspectRatioFull will fill the available space:

https://wolfram.com/xid/0cqzvyzm-eoq41h

Use maximum sizes for the width and height:

https://wolfram.com/xid/0cqzvyzm-cw2364

Use ImageSizeFull to fill the available space in an object:

https://wolfram.com/xid/0cqzvyzm-buwcj1

Specify the image size as a fraction of the available space:

https://wolfram.com/xid/0cqzvyzm-copoio

MaxPlotPoints (1)
Use MaxPlotPoints to limit the number of elements explicitly plotted in each direction:

https://wolfram.com/xid/0cqzvyzm-lk6


https://wolfram.com/xid/0cqzvyzm-h4t

Mesh (7)
Insert mesh lines between all cells:

https://wolfram.com/xid/0cqzvyzm-c3b

Insert 15 row mesh lines and 5 column mesh lines:

https://wolfram.com/xid/0cqzvyzm-vzs

Insert mesh lines around the first 10 columns:

https://wolfram.com/xid/0cqzvyzm-ts6

Use a sequence of colors for the mesh lines:

https://wolfram.com/xid/0cqzvyzm-oll

Insert mesh lines after the first and second rows:

https://wolfram.com/xid/0cqzvyzm-epxexl

Use MeshAutomatic to draw mesh for the data in a ragged array:

https://wolfram.com/xid/0cqzvyzm-k5la1e

Use Mesh"Nonzero" to draw mesh lines around nonzero cells:

https://wolfram.com/xid/0cqzvyzm-g1sex

MeshStyle (2)
PlotLegends (5)

https://wolfram.com/xid/0cqzvyzm-60vtmd

Generate a legend automatically:

https://wolfram.com/xid/0cqzvyzm-x7pg71


https://wolfram.com/xid/0cqzvyzm-6w6hqh

PlotLegends automatically picks up ColorFunction:

https://wolfram.com/xid/0cqzvyzm-dyene3

Legend uses ColorRules as labels:

https://wolfram.com/xid/0cqzvyzm-7g42yr

Use Placed to place legend outside the plot:

https://wolfram.com/xid/0cqzvyzm-50sf9j


https://wolfram.com/xid/0cqzvyzm-jiib7k

PlotRange (5)

https://wolfram.com/xid/0cqzvyzm-dx7

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

https://wolfram.com/xid/0cqzvyzm-gfo

The first two entries in PlotRange specify the range of rows and columns to include:

https://wolfram.com/xid/0cqzvyzm-kgc

With specific plot range {amin,amax}, the colors range from white at amin to black at amax:

https://wolfram.com/xid/0cqzvyzm-nus


https://wolfram.com/xid/0cqzvyzm-n2d

Applications (11)Sample problems that can be solved with this function
Plot a two-color cellular automaton evolution:

https://wolfram.com/xid/0cqzvyzm-yx0

Plot a three-color cellular automaton evolution:

https://wolfram.com/xid/0cqzvyzm-di6

Use colors rather than gray levels:

https://wolfram.com/xid/0cqzvyzm-sxp

Plot the imaginary parts of a Vandermonde matrix for a discrete Fourier transform:

https://wolfram.com/xid/0cqzvyzm-9lmjdi

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

https://wolfram.com/xid/0cqzvyzm-2n0i6v

Show positive entries as black and others as yellow:

https://wolfram.com/xid/0cqzvyzm-3rxhks


https://wolfram.com/xid/0cqzvyzm-xhq

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

https://wolfram.com/xid/0cqzvyzm-k18zdm


https://wolfram.com/xid/0cqzvyzm-o3y


https://wolfram.com/xid/0cqzvyzm-jiz

Use a special color for non-numeric data:

https://wolfram.com/xid/0cqzvyzm-lrv


Digits of powers of 3 in base 2:

https://wolfram.com/xid/0cqzvyzm-w6k

Plot a sparse matrix in black and white:

https://wolfram.com/xid/0cqzvyzm-xmz

https://wolfram.com/xid/0cqzvyzm-qc6

Properties & Relations (8)Properties of the function, and connections to other functions
An empty array yields a blank picture:

https://wolfram.com/xid/0cqzvyzm-ctg

Grid arranges elements the same way as ArrayPlot:

https://wolfram.com/xid/0cqzvyzm-jif


https://wolfram.com/xid/0cqzvyzm-pbp

Raster arranges elements upside down and with colors reversed relative to ArrayPlot:

https://wolfram.com/xid/0cqzvyzm-klf

Make the array be shown the same way as in ArrayPlot:

https://wolfram.com/xid/0cqzvyzm-mbj

Use ArrayPlot3D for 3D arrays of data:

https://wolfram.com/xid/0cqzvyzm-1rvqxy

Use MatrixPlot when entries have a big range and many different values:

https://wolfram.com/xid/0cqzvyzm-43ooh


https://wolfram.com/xid/0cqzvyzm-eegt3p


https://wolfram.com/xid/0cqzvyzm-753gmi

Use ReliefPlot for medical and geographic data:

https://wolfram.com/xid/0cqzvyzm-yy9gks

Use ListDensityPlot for structured or unstructured data sampled from continuous densities:

https://wolfram.com/xid/0cqzvyzm-c3o2zs


https://wolfram.com/xid/0cqzvyzm-3erur

Use GraphPlot for visualizing adjacency matrices:

https://wolfram.com/xid/0cqzvyzm-ebepe8

Possible Issues (2)Common pitfalls and unexpected behavior
ArrayPlot may not be able to distinguish between large numbers of different values:

https://wolfram.com/xid/0cqzvyzm-bkmfdv

https://wolfram.com/xid/0cqzvyzm-enwuaa

Use MatrixPlot instead (or provide a custom ColorFunction):

https://wolfram.com/xid/0cqzvyzm-e25ia7

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

https://wolfram.com/xid/0cqzvyzm-xc2mwo

MatrixPlot scales entries so that entries with small relative absolute values can still be seen:

https://wolfram.com/xid/0cqzvyzm-2gemyn

Wolfram Research (2004), ArrayPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/ArrayPlot.html (updated 2021).
Text
Wolfram Research (2004), ArrayPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/ArrayPlot.html (updated 2021).
Wolfram Research (2004), ArrayPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/ArrayPlot.html (updated 2021).
CMS
Wolfram Language. 2004. "ArrayPlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ArrayPlot.html.
Wolfram Language. 2004. "ArrayPlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ArrayPlot.html.
APA
Wolfram Language. (2004). ArrayPlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ArrayPlot.html
Wolfram Language. (2004). ArrayPlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ArrayPlot.html
BibTeX
@misc{reference.wolfram_2025_arrayplot, author="Wolfram Research", title="{ArrayPlot}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ArrayPlot.html}", note=[Accessed: 01-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_arrayplot, organization={Wolfram Research}, title={ArrayPlot}, year={2021}, url={https://reference.wolfram.com/language/ref/ArrayPlot.html}, note=[Accessed: 01-April-2025
]}