ComplexArrayPlot

ComplexArrayPlot[array]

generates a plot in which complex values zij in an array array are shown in a discrete array of squares with Arg[zij] indicated by color and Abs[zij] by shading.

Details and Options

  • ComplexArrayPlot is used to visualize tables of complex numbers.
  • ComplexArrayPlot[array] by default arranges successive rows of the mn dimensional array down the page and successive columns across, just as a table or grid would normally be formatted.
  • ComplexArrayPlot uses a cyclic color function over the values of Arg[zij] and shading to indicate values of Abs[zij]. Complex numbers with large moduli are lighter than numbers with smaller moduli.
  • In ComplexArrayPlot[array], array can have the following forms:
  • {{z11,z12,,z1n},,{zm1,zm2,,zmn}}values zij
    SparseArrayvalues as a normal array
    NumericArrayvalues as a normal array
    Datasetvalues as a normal array
  • The following special entries can be used for the zij:
  • Nonebackground color
    color directivespecified color
  • If array is ragged, shorter rows are treated as padded on the right with background.
  • ComplexArrayPlot has the same options as Graphics, with the following additions and changes:
  • AspectRatioAutomaticratio of height to width
    ClippingStyleNonehow to show cells whose values are clipped
    ColorFunctionAutomatichow each cell should be colored
    ColorFunctionScalingTruewhether to scale the argument to ColorFunction
    ColorRulesAutomaticrules for determining colors from values
    DataRangeAllthe range of and values to assume
    DataReversedFalsewhether to reverse the order of rows
    FrameAutomaticwhether to draw a frame around the plot
    FrameLabelNonelabels for rows and columns
    FrameTicksNonewhat ticks to include on the frame
    MaxPlotPointsInfinitythe maximum number of points to include
    MeshFalsewhether to draw a mesh
    MeshStyleGrayLevel[GoldenRatio-1]the style to use for a mesh
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    PlotLegendsNonelegends for datasets
    PlotRangeAllthe 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 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 ColorFunctioncfunc is used instead of ColorRules.
  • ColorFunction->{cfunc,sfunc} uses cfunc to generate the base color and sfunc to adjust the color to highlight features.
  • Possible named settings for sfunc are:
  • Automaticautomatic shading based on Abs[z]
    "MaxAbs"light shading of large values of Abs[z]
    "LocalMaxAbs"light shading of an upper quantile of Abs[z]
    "GlobalAbs"dark to light shading of small to large values of Abs[z]
    "QuantileAbs"dark to light shading based on quantiles of Abs[z]
    "CyclicLogAbs"cyclic dark to light shading of Log[Abs[z]]
    "CyclicArg"cyclic dark to light shading of Arg[z]
    "CyclicLogAbsArg"cyclic shading of Log[Abs[z]] and Arg[z]
    "CyclicReImLogAbs"dark cycles of Re[z] and Im[z] and light cycles of Log[Abs[z]]
    "ShiftedCyclicLogAbs"cyclic shading of Log[Abs[z]] after a threshold
    Noneno shading
  • Functions in ColorFunction are by default supplied with scaled versions of Re[z], Im[z], Abs[z], Arg[z].
  • 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 .
  • PlotRange can take the following forms:
  • zmaxshow Abs[zij] values between 0 and zmax
    {zmin,zmax}show Abs[zij] values between zmin and zmax
    {rangei,rangej}show zij values with i in rangei and j in rangej
    {rangei,rangej,rangez}show zij values with i in rangei, j in rangej, and zij in rangez
  • The array index ranges rangei and rangej 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
  • Mesh->True draws mesh lines between each cell in the array.
  • Mesh->{mi,mj} gives mesh specifications for the and directions, respectively.
  • 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 , .

Examples

open allclose all

Basic Examples  (6)

Plot an array of numbers:

Give explicit color directives to specify colors for individual cells:

Specify overall color rules:

Include a mesh:

Plot a table of data:

Use a standard blend as a color function:

Scope  (14)

Data  (8)

By default, colors change with argument from (cyan) to (red) to (cyan):

By default, colors are lighter for complex numbers with larger moduli:

Unknown, symbolic or missing values are shown dark red:

Specify explicit colors for cells:

Plot a ragged array, padding on the right:

Cells with value None are rendered like the background:

Plot a sparse array:

Plot a numeric array:

Presentation  (6)

Add a mesh:

Add a legend:

Turn off the default shading:

Change the color function:

Use shading schemes like ComplexPlot:

Choose a color function and a shading scheme:

Options  (65)

AspectRatio  (2)

Make all cells square:

Use a different aspect ratio:

Background  (4)

Background is normally visible only around the edges:

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

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

ClippingStyle overrides background color:

ClippingStyle  (3)

The default is to show values of with values outside the TemplateBox[{z}, Abs] plot range in the background color:

Show values outside the plot range in red:

Show low values in black and high values in red:

ColorFunction  (9)

By default, complex values are colored by Arg[z] and shaded by Abs[z]:

Turn off the shading based on Abs[z]:

Map modulus 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:

Specify a shading scheme:

Specify a color function and a shading scheme:

With ColorFunctionScalingTrue, the values are first scaled to lie between 0 and 1:

Use a color function that colors complex values by Re[z], Im[z], Abs[z] or Arg[z]:

ColorFunctionScaling  (3)

By default, values are scaled to lie between 0 to 1 before applying the color function:

Choose to not scale the argument prior to applying the color function:

Some color functions are not cyclic so the colors only change in a small band:

ColorRules  (6)

Specify color rules for explicit values:

Specify color rules for patterns:

ColorFunction is used if no color rules apply:

The array can contain symbolic values:

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

Rules are used in the order given:

DataRange  (5)

By default, data are plotted at integer coordinates:

Specify a range for the data:

Specify a range for the data with a pair of complex numbers:

Specify the bottom-left corner of the data range:

Specify the top-right corner of the data range:

DataReversed  (4)

Reverse the order of rows:

The frame ticks give the original row numbers:

Reverse the order of rows and columns:

Reverse the order of columns:

Epilog  (3)

Use Epilog to superimpose other graphics:

Epilog uses the standard Graphics coordinate system:

The graphics can be translucent:

Frame  (1)

Do not use a frame:

FrameLabel  (3)

Label the bottom and left edges of the frame:

Label all four edges of the frame:

Do not rotate the labels on the left and right edges of the frame:

FrameTicks  (5)

Put frame ticks at round numbers:

Include frame ticks for endpoints:

Frame ticks at specific values:

Frame ticks without a visible frame:

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

MaxPlotPoints  (1)

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

Mesh  (4)

Insert mesh lines between all cells:

Insert 1 row mesh line and 3 column mesh lines:

Insert mesh lines around the first 4 columns:

Specify styles for the mesh lines:

MeshStyle  (2)

Style the mesh lines:

Style the row lines differently than the column lines:

PlotLegends  (5)

No legend is used by default:

Generate a legend automatically:

PlotLegends automatically picks up a named ColorFunction:

PlotLegends does not pick up a user-defined ColorFunction, but the user can still construct an appropriate legend:

Use Placed to change the location of the legend:

PlotRange  (4)

Plot all elements:

Plot values of for which 1Abs[z]2:

Plot values of for which Abs[z]2:

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

PlotTheme  (1)

Use a theme with detailed ticks and a legend:

Move the legend below the plot:

Applications  (18)

Fourier Transforms  (6)

Generate a pure discrete two-dimensional sinusoid:

Compute the two-dimensional Fourier transform:

Display the original data and its Fourier transform. In the second plot, the bright square in row 4 and column 6 (measured from the top-left corner) tells us that the corresponding frequencies are 3 and 5, respectively:

Generate a linear combination of discrete sinusoids:

Identify the component frequencies in the Fourier transform:

Display two-dimensional data and its Fourier transform:

Use ColorRules to threshold a Fourier transform:

Display only the top-left quarter of the Fourier transform:

Model the intensity of light diffracted by a small circular aperture:

Display the diffraction pattern and its Fourier transform:

Create data and modify it by shifting the columns left:

The magnitude of Fourier transforms are graphed, but that does not reveal potentially useful phase information. Observe the extra information in the middle plot:

Note the change in the ComplexArrayPlot and the lack of change in the ArrayPlot of the Fourier transform:

Matrix Representations  (3)

Plot a sparse matrix with complex entries:

Plot a random complex-valued matrix:

Visually verify that the matrix is diagonalized:

Visualize the matrices in a matrix factorization:

Visually compare Kronecker products:

Basins of Attraction  (2)

Define a complex valued function with roots at 1, ±2π /3:

Compute the corresponding Newton map:

Compute approximations to the roots of for various starting values:

Display the basins of attraction:

Define a complex-valued function with an infinite number of roots, ,:

Compute the corresponding Newton map:

Note that the roots only have three distinct argument values, and :

Compute approximations to the roots of for various starting values:

Display the basins of attraction, using shading to highlight the dependence on the modulus of the roots:

Define a complex-valued function with roots at 1, ±2π /3:

Newton's method has quadratic convergence, but Halley's method has cubic convergence:

Compute approximations to the roots of for various starting values:

Display the basins of attraction for Halley's method:

Matrix Spectra  (2)

Display eigenvalues from a two-parameter family of matrices:

Define a matrix:

Compute its eigenvalues:

The ϵ-pseudospectrum of the matrix is the set of values in the complex plane for which the norm of (m-λ I)-1 is greater than 1/(epsilon). Graph the ϵ-pseudospectra for ϵ=1,1/2,1/4,1/8,1/16,1/32 and note the eigenvalues at the white dots:

If we use the largest eigenvalue instead of the norm of (m-λ I)-1, then we can add argument information:

Create a Toeplitz matrix:

Make a plot similar to an ϵ-pseudospectral plot:

Use a named matrix:

Make a graph similar to a spectral portrait:

Iterated Systems  (3)

Visualize complex cellular automata:

Compute iterates of a complex-valued function:

Display the data on a width of 10:

The iterates appear to converge for a different constant:

Iterates are periodic for carefully chosen constants:

Let be the logistic function with a complex coefficient . Consider the sequence , for . Approximate the values of for which is unbounded and visualize the region:

Miscellaneous  (2)

Highlight Gaussian primes in black:

Plot a Fourier matrix:

Highlight the purely real and purely imaginary entries in black and gray, respectively:

Properties & Relations  (5)

ComplexArrayPlot colors complex values by their arguments and shades by their moduli like ComplexPlot:

ComplexArrayPlot is similar to ArrayPlot and MatrixPlot applied to the arguments of the complex values:

Grid arranges elements the same way as ComplexArrayPlot:

Raster arranges elements upside down relative to ComplexArrayPlot:

ArrayPlot3D can be used for 3D arrays of data:

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

Text

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

BibTeX

@misc{reference.wolfram_2021_complexarrayplot, author="Wolfram Research", title="{ComplexArrayPlot}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/ComplexArrayPlot.html}", note=[Accessed: 03-August-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_complexarrayplot, organization={Wolfram Research}, title={ComplexArrayPlot}, year={2020}, url={https://reference.wolfram.com/language/ref/ComplexArrayPlot.html}, note=[Accessed: 03-August-2021 ]}

CMS

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

APA

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