ArrayPlot3D

ArrayPlot3D[array]

generates a plot in which the values in an array are shown in a discrete array of cubes.

Details and Options

  • ArrayPlot3D[array] by default arranges the array elements aijk with increasing values of i going from top to bottom, j from back to front and k from left to right.
  • Possible forms of array include:
  • {{{a111,,a11t},,{a1s1,,a1st}},,{{ar11,,ar1t},,{ars1,,arst}}}normal array
    SparseArrayvalues as a normal array
    QuantityArraymagnitudes
    NumericArrayvalues as a normal array
    SymmetrizedArrayvalues as a normal array
    Datasetvalues as a normal array
  • If array is ragged, shorter dimensions are treated as padded on the right with empty space.
  • If array contains 0s and 1s, the 1s will appear as black cubes and the 0s as empty space.
  • ArrayPlot3D has the same options as Graphics3D, with the following additions and changes:
  • AxesFalsewhether to draw axes
    BoxedTruewhether to draw the bounding box
    ClippingStyle Nonehow to show cells whose values are clipped
    ColorFunction Automatichow each cell should be colored
    ColorFunctionScaling Truewhether to scale the argument to ColorFunction
    ColorRules Automaticrules for determining colors from values
    DataRange Allthe range of and values to assume
    DataReversed Falsewhether to reverse the order of rows
    Lighting"Neutral"whether to use lighting
    Mesh Automaticwhether to draw a mesh
    MeshStyle Automaticthe style to use for a mesh
    MethodAutomaticthe method to use for displaying the array
    MissingStyleAutomaticthe style to use for missing values
    OpacityFunction Automatichow to compute the opacity at each cell
    OpacityFunctionScaling Truewhether to scale the arguments to OpacityFunction
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    PlotLegends Nonelegends for datasets
    PlotRange Allthe range of values to plot
    PlotTheme $PlotThemeoverall theme for the plot
    TargetUnitsAutomaticunits to display in the plot
  • The rules given by ColorRules are applied to the value aijk 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.
  • If the color determined for a particular cell is None, the cell is treated as empty space.
  • If no color is determined for a particular cell, the cell is rendered in the color given by MissingStyle, by default a dark red color.
  • ColorFunction and OpacityFunction are supplied with a single argument, given by default by the value of aijk scaled to be between 0 and 1.
  • 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 TicksAutomatic, ticks are placed at round integers, typically multiples of 5 or 10.
  • With the setting TicksAll, ticks are also placed at the minimum and maximum values of i, j and k.
  • In explicit Ticks specifications, the tick coordinates are taken to refer to i, j and k.
  • PlotRange can take the following forms:
  • amaxshow aijk values between 0 and amax
    {amin,amax}show aijk values between amin and amax
    {rangei,rangej,rangek}show aijk values with i in rangei,
    {rangei,rangej,rangek,rangea}show aijk values with i in rangei, and aijk in rangea
  • The array index ranges rangei, rangej and rangek can take the following forms:
  • {min,max}include indices between min and max
    Allinclude all indices
  • Typical settings for PlotLegends include:
  • Noneno legend
    Automaticautomatically determine legend
    Placed[lspec,]specify placement for legend
  • Possible settings for Mesh include:
  • Automaticautomatically show the mesh
    Nonedo not show the mesh
    Fullshow mesh adjacent to filled array cells
    Allshow mesh adjacent to all array cells
    {speci,specj,speck}show the mesh in particular dimensions
  • The possible settings for Method include "Graphics3D", "Raster3D" and "ArrayMesh".

Examples

open allclose all

Basic Examples  (4)

Plot an array of numbers:

Display the state of a 3D cellular automaton:

Specify overall color rules:

Use a standard blend as a color function:

Scope  (6)

By default, 0 is not plotted and 1 is plotted in black:

With no opacity, 0 is plotted in white:

Plot data with units:

Plot a ragged array, padding on the right:

Cells with value None are rendered like the background:

Plot a sparse array:

Options  (32)

AspectRatio  (2)

Make all cells cubes:

Use a different aspect ratio:

By default, ArrayPlot3D does not show any axes:

AxesLabel  (3)

No axis labels are drawn by default:

Place a label on the axis:

Specify axes labels:

AxesStyle  (4)

Change the style for the axes:

Specify the style of each axis:

Use different styles for the ticks and the axes:

Use different styles for the labels and the axes:

ClippingStyle  (1)

The default is to not show values outside the plot range:

Show values outside the plot range in red:

Show low values in gray and high values in green:

ColorFunction  (2)

Map values from 0 to 1 onto colors according to Hue:

Use a pure function as the color function:

Use a named color gradient from ColorData:

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

ColorFunctionScaling  (1)

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

ColorRules  (1)

Specify color rules for explicit values or patterns:

ColorFunction is used if no color rules apply:

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

Use any patterns in ColorRules:

Rules are used in the order given:

DataRange  (1)

By default, array values are assumed to have integer i, j and k values:

Specify the i, j, k coordinate range for tabular data:

DataReversed  (1)

Reverse the order of j and k values:

Reverse the order of i, j and k values:

Mesh  (1)

Insert mesh lines between all cells:

MeshStyle  (1)

Default mesh style:

Make the mesh pink:

OpacityFunction  (4)

OpacityFunction is Automatic by default:

Use None to make the whole array opaque:

Use a custom opacity function to specify the opacity for each value:

Use a constant opacity Opacity[0.5]:

OpacityFunctionScaling  (2)

By default, scaled values are used:

Use unscaled values by setting OpacityFunctionScaling to False:

PlotLegends  (2)

No legend is used by default:

Generate a legend automatically:

PlotLegends automatically picks up ColorFunction:

PlotRange  (2)

Plot all elements:

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

The first three entries in PlotRange specify the range of i, j and k values to include:

Plot positive elements only:

PlotTheme  (1)

Use a theme with detailed ticks and a legend:

Ticks  (2)

Put ticks at round numbers:

Ticks at specific values:

Applications  (6)

Cellular Automata  (2)

Plot the state of a 3D cellular automaton:

Plot the evolution of a 2D three-color cellular automaton:

Array Structures  (4)

Highlight a specific element in an array:

Highlight a column of values:

Highlight a slice of an array:

Highlight a sub-block of values:

Properties & Relations  (6)

Use ArrayPlot or MatrixPlot for 2D arrays:

ArrayPlot3D uses 3D arrays, even if one of the dimensions is 1:

Raster3D arranges elements in the opposite orders from ArrayPlot3D:

The DataReversed option allows ArrayPlot3D to use the same order as Raster3D:

Use ListDensityPlot3D for continuous densities, using varying opacity to see interior features:

Image3D uses interpolated volumetric rendering to display the data:

ReliefPlot creates artificial shadows for 2D data:

Use ComplexArrayPlot for 2D arrays of complex-valued data:

Neat Examples  (3)

Plot the Sin function at integer points:

Evolution of a totalistic 3D cellular automaton:

Interactively map GCD values onto colors using Hue:

Wolfram Research (2020), ArrayPlot3D, Wolfram Language function, https://reference.wolfram.com/language/ref/ArrayPlot3D.html.

Text

Wolfram Research (2020), ArrayPlot3D, Wolfram Language function, https://reference.wolfram.com/language/ref/ArrayPlot3D.html.

CMS

Wolfram Language. 2020. "ArrayPlot3D." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ArrayPlot3D.html.

APA

Wolfram Language. (2020). ArrayPlot3D. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ArrayPlot3D.html

BibTeX

@misc{reference.wolfram_2022_arrayplot3d, author="Wolfram Research", title="{ArrayPlot3D}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/ArrayPlot3D.html}", note=[Accessed: 26-March-2023 ]}

BibLaTeX

@online{reference.wolfram_2022_arrayplot3d, organization={Wolfram Research}, title={ArrayPlot3D}, year={2020}, url={https://reference.wolfram.com/language/ref/ArrayPlot3D.html}, note=[Accessed: 26-March-2023 ]}