# ListDensityPlot ListDensityPlot[{{f11,,f1n},,{fm1,,fmn}}]

generates a smooth density plot from an array of values fij.

ListDensityPlot[{{x1,y1,f1},,{xk,yk,fk}}]

generates a density plot with values fi defined at specified points {xi,yi}.

# Details and Options    • ListDensityPlot is also known as heat map and intensity plot.
• Regular data {{f11,,f1n},,{fm1,,fmn}} is plotted as a color at the point {x,y} where has value fij and c is a color-valued function.
• Irregular data {{x1,y1,f1},,{xk,yk,fk}} is plotted as a color at the point {x,y} where has value fi and c is a color-valued function.
• The plot visualizes the set where is a color-valued function and the region is the Cartesian product for regular data and the convex hull of {{x1,y1},,{xn,yn}} for irregular data.
• • For regular data {{f11,,f1n},,{fm1,,fmn}}, the location for value fij is taken to be . Use the option DataRange to override that.
• ListDensityPlot is intended for continuous data; ArrayPlot is intended for discrete data.
• By default, the color scale generates output in which larger values are shown as lighter colors.
• ListDensityPlot[data] can use the following forms and interpretations for data:
•  {<|xkeyx1,ykeyy1,fkeyf1|>,…,<|xkeyxn,ykeyyn,fkeyfn|>} irregular {x,y,f} triples {xi,yi,fi} {{x1,y1},…,{xn,yn}}{f1,…,fn} irregular {x,y,f} triples {xi,yi,fi} Dataset values as a normal array NumericArray values as a normal array QuantityArray magnitudes SparseArray values as a normal array
• ListDensityPlot has the same options as Graphics, with the following additions and changes:
•  AspectRatio 1 ratio of height to width BoundaryStyle None how to draw RegionFunction boundaries BoxRatios Automatic effective 3D bounding box ratios ClippingStyle None how to draw values clipped by PlotRange ColorFunction Automatic how to color the plot ColorFunctionScaling True whether to scale the argument to ColorFunction DataRange Automatic the range of x and y values to assume for data Frame True whether to draw a frame around the plot FrameTicks Automatic frame tick marks InterpolationOrder None the polynomial degree in each variable of the interpolated density between data points LightingAngle None effective angle of the simulated light source MaxPlotPoints Automatic the maximum number of points to include Mesh None how many mesh lines in each direction to draw MeshFunctions {#1&,#2&} how to determine the placement of mesh lines MeshStyle Automatic the style for mesh lines Method Automatic the method to use for interpolation and data reduction PerformanceGoal \$PerformanceGoal aspects of performance to try to optimize PlotLayout Automatic how to position densities PlotLegends None legends for color gradients PlotRange {Full,Full,Automatic} the range of f or other values to include PlotRangePadding Automatic how much to pad the range of values PlotRangeClipping True whether to clip at the plot range PlotTheme \$PlotTheme overall theme for the plot RegionFunction (True&) how to determine whether a point should be included ScalingFunctions None how to scale individual coordinates VertexColors Automatic colors to assume at every point
• DataRange determines the {x,y} position for value fij in the array {{f11,,f1n},,{fm1,,fmn}}. Possible settings include:
•  Automatic,All uniform in x from 1 to n and in y from 1 to m {{xmin,xmax},{ymin,ymax}} uniform in x from xmin to xmax and in y from ymin to ymax
• The case ListDensityPlot[{{a11,a12,a13},}] can be interpreted as both regular and irregular data. With it is interpreted as irregular {{x1,y1,f1},{x2,y2,f2},} and with it is interpreted as regular {{f11,,f1n},,{fm1,,fmn}}.
• Possible settings for ScalingFunctions include:
•  sf scale the f-values {sx,sy} scale x and y axes {sx,sy,sf} scale x and y axes and f-values
• Each scaling function si is either a string "scale" or {g,g-1}, where g-1 is the inverse of g.
• For ListDensityPlot[array], Mesh->Full draws a mesh that crosses at the position of each data point.
• The arguments supplied to functions in MeshFunctions and RegionFunction are x, y, f.
• ColorFunction is supplied with a single argument, given by default by the scaled value of f.
• Typical settings for PlotLegends include:
•  None no legend Automatic automatically determine legend from ColorFunction Placed[lspec,…] specify placement for legend
• Possible settings for PlotLayout that show single densities in multiple plot panels include:
•  "Column" use separate densities in a column of panels "Row" use separate densities in a row of panels {"Column",k},{"Row",k} use k columns or rows {"Column",UpTo[k]},{"Row",UpTo[k]} use at most k columns or rows
• • The setting for VertexColors must be an array or list with the same structure as the array or list of values.
• An explicit setting for VertexColors overrides colors determined from ColorFunction.
• ListDensityPlot returns Graphics[GraphicsComplex[data]].

# Examples

open allclose all

## Basic Examples(4)

Use an array of values to define heights for a density:

Give explicit , , coordinates for points in a density:

A larger set of , , samples:

Use a multipanel layout to show multiple datasets at the same time:

Use different interpolations of data:

## Scope(15)

### Data(8)

For regular data consisting of values, the and data ranges are taken to be integer values:

Provide explicit and data ranges by using DataRange:

For irregular data consisting of triples, the and data ranges are inferred from data:

Areas around where the data is nonreal are excluded:

Use MaxPlotPoints to limit the number of points used:

PlotRange is selected automatically:

Use PlotRange to focus in on areas of interest:

Use RegionFunction to restrict the density to a region given by inequalities:

### Presentation(7)

Color the density by height:

Include a legend:

Provide overlay meshes:

Provide an interactive Tooltip for the density:

Use a theme with simple ticks and a legend in a bold color scheme:

Use a multipanel layout to show multiple datasets at the same time:

Use a column instead of a row:

## Options(94)

### AspectRatio(4)

By default, ListDensityPlot uses the same width and height:

Use a numerical value to specify the height to width ratio:

determines the ratio from the plot ranges:

adjusts the height and width to tightly fit inside other constructs:

### Axes(4)

By default, ListDensityPlot uses a frame instead of axes:

Use axes instead of a frame:

Use AxesOrigin to specify where the axes intersect:

Turn each axis on individually:

### AxesLabel(4)

No axes labels are drawn by default:

Place a label on the axis:

Specify axes labels:

Use units as labels:

### AxesOrigin(2)

The position of the axes is determined automatically:

Specify an explicit origin for the axes:

### 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:

### BoundaryStyle(4)

No boundary is used by default:

Use a red boundary around the edges of the surface:

BoundaryStyle applies to holes cut by RegionFunction:

BoundaryStyle applies between Voronoi regions associated with the data:

### ClippingStyle(4)

Clipped regions are not shown by default:

Color clipped regions like the rest of the density:

Use pink to fill the clipped regions:

Use light red where the surface is clipped above and pink below:

### ColorFunction(5)

Color by scaled coordinate:

Specify gray-level intensity by scaled coordinate:

Named color gradients color in the direction:

Use brightness to correspond to the height or density of a function:

Use the interpolation between two colors to indicate the height or density of a function:

### ColorFunctionScaling(1)

Get the natural range of values by setting ColorFunctionScaling to False:

### DataRange(4)

Arrays of height values are displayed against the number of elements in each direction:

Rescale to the sampling space:

Triples are interpreted as , , coordinates:

Force interpretation as arrays of height values:

The dataset is normally interpreted as a list of triples:

### ImageSize(7)

Use named sizes such as Tiny, Small, Medium and Large:

Specify the width of the plot:

Specify the height of the plot:

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

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

Setting will fill the available space:

Use maximum sizes for the width and height:

Use to fill the available space in an object:

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

### InterpolationOrder(5)

Densities are normally blended across polygons:

Use zero-order or piecewise constant interpolation:

Use third-order spline interpolation to fit the data:

Interpolation order 0 to 5:

For irregular data, zero-order interpolation gives Voronoi regions for each point:

### MaxPlotPoints(4)

ListDensityPlot normally uses all the points in the dataset:

Limit the number of points used in each direction:

MaxPlotPoints imposes a regular grid on irregular data:

The grid does not extend beyond the convex hull of the original data:

### Mesh(7)

No mesh is used by default:

Show the initial and final sampling mesh:

The entire mesh for irregular data is a Delaunay triangulation:

Use 5 mesh lines in each direction:

Use 3 mesh lines in the direction and 6 mesh lines in the direction:

Use mesh lines at specific values:

Use different styles for different mesh lines:

### MeshFunctions(3)

Use the value as the mesh function, giving a continuously colored contour plot:

Use mesh lines in the and directions:

Show where the real and imaginary parts of a function are constant over the complex plane:

### MeshStyle(3)

Mesh lines are partially transparent by default:

Use red mesh lines:

Use red mesh lines in the direction and dashed mesh lines in the direction:

### PerformanceGoal(2)

Generate a higher-quality plot:

Emphasize performance, possibly at the cost of quality:

### PlotLayout(3)

Place each density in a separate panel using shared axes:

Use a row instead of a column:

Use multiple columns or rows:

Prefer full columns or rows:

### PlotLegends(5)

No legend is used, by default:

Include a legend:

Legends automatically use the same colors as the density plot:

Use Placed to change legend placement:

Use BarLegend to customize the legend:

### PlotRange(2)

Automatically compute the range and clip extreme portions of it:

Use all points to compute the range:

### PlotTheme(2)

Use a theme with simple ticks and a legend in a bright color scheme:

Change the color scheme:

### RegionFunction(4)

Plot over a region in :

The region depends on DataRange:

Regions do not have to be connected:

Use any logical combination of conditions:

### ScalingFunctions(9)

By default, plots have linear scales in each direction:

Use a log scale in the direction:

Use a linear scale in the direction that shows smaller numbers at the top:

Use a reciprocal scale in the direction:

Use different scales in the and directions:

Reverse the axis without changing the axis:

Use a scale defined by a function and its inverse:

Positions in Ticks and GridLines are automatically scaled:

PlotRange is automatically scaled:

### VertexColors(2)

ListDensityPlot usually colors the density using a color function:

Specify random colors for each vertex:

## Applications(3)

Plot a probability density function of two variables:

Compare to the empirical density function:

Show the regions closest to a set of points:

Show ozone density around the world:

Use CountryData to add country outlines:

## Properties & Relations(16)

ListDensityPlot is similar to ListPlot3D viewed from above:

ListDensityPlot and ListPlot3D view as a function of and :

The data has only one value for each , pair:

The data has two values for each , pair:

Use ListDensityPlot3D to plot 3D data:

ListDensityPlot associates colors with the vertices of polygons:

Raster, ArrayPlot, MatrixPlot, and ReliefPlot associate colors with the whole polygon:

Use ArrayPlot for arrays of discrete data:

Use MatrixPlot for structural plots of matrices:

Use ReliefPlot for matrices corresponding to medical and geographic values:

Use DensityPlot for functions:

Smoothly shade a map using color with GeoDensityPlot:

Use ListPointPlot3D to show three-dimensional points:

ListDensityPlot produces smooth color variations:

Use ListContourPlot to get segmented colors:

Use ListPlot3D to create surfaces from continuous data:

Use ListLogPlot, ListLogLogPlot, and ListLogLinearPlot for logarithmic plots:

Use ListPolarPlot for polar plots:

Use DateListPlot to show data over time:

Use ParametricPlot3D for three-dimensional parametric curves and surfaces:

## Possible Issues(2)

The appearance may depend on the source of the data:

An ×3 matrix is by default interpreted as a list of triples:

Use to force interpretation as a matrix of values:

Or provide an explicit list of data ranges to force interpretation as a matrix of values: