Mathematica 9 is now available

ArrayPlot

Usage

ArrayPlot[array] generates a plot in which the values in an array are shown in a discrete array of squares.


Notes

ArrayPlot[array] 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 0's and 1's, the 1's will appear as black squares and the 0's 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.
ArrayPlot has the same options as Graphics, with the following additions and changes:
AspectRatio Automatic ratio of height to width
ColorFunction Automatic how each cell should be colored
ColorFunctionScaling False whether to scale the argument to ColorFunction
ColorRules Automatic rules for determining colors from values
DataRange All the range of  and  values to assume
Frame Automatic whether to draw a frame around the plot
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
PixelConstrained False whether to constrain cells to align with pixels
PlotRange All the range of values to plot
ColorRules -> {0->Red, 1->Blue, _->Black} specifies that cells with value 0 should be red, those with value 1 should be blue, and all others should be black.
• The rules given by ColorRules are applied to the value  of each cell.
• If none of the rules in ColorRules applies, 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 the default setting 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.
• 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  .
PlotRange -> { ,  } specifies that only those  between  and  should be shown.
PlotRange -> {{ ,  }, { ,  }} shows only elements with  and  in the specified ranges. The top-left element has  ,  .  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->{ ,  } specifies that values from  to  should be shown with grayscales varying from white to black.
ColorFunction -> (GrayLevel[If[#Equal0, 1, 0]]&) generates a plot in which all nonzero values are shown as black.
Mesh -> True draws mesh lines between each cell in the array.
• With the default setting Frame -> Automatic, a frame is drawn only when Mesh -> False.
• With the default setting DataRange -> All, the array element  will be taken to cover a unit square centered at coordinate position  ,  .
ArrayPlot returns Graphics[Raster[data]].
• With PixelConstrained -> True, ArrayPlot generates a 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 ImageSize setting specified.
• New in Version 5.1.


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.