ListDensityPlot
ListDensityPlot[array]
generates a smooth density plot from an array of values.
ListDensityPlot[{{x1,y1,f1},{x2,y2,f2},…}]
generates a density plot with values defined at specified points.
Details and Options




- ListDensityPlot[array] arranges successive rows of array up the page, and successive columns across.
- ListDensityPlot linearly interpolates values so as to give smooth shading.
- ListDensityPlot is mainly intended for discrete samplings of continuous data; ArrayPlot is intended for purely discrete data.
- ListDensityPlot by default generates output in which larger values are shown lighter.
- 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 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 - array should be a rectangular array of real numbers; holes will be left in the plot whenever there are elements that are not real numbers.
- ListDensityPlot[array] by default takes the x and y coordinate values for each data point to be successive integers starting at 1.
- The setting DataRange->{{xmin,xmax},{ymin,ymax}} specifies other ranges of coordinate values to use.
- With the default setting DataRange->Automatic, ListDensityPlot[{{a11,a12,a13},…,{an1,an2,an3}}] will assume that the data being given is {{x1,y1,f1},…}, rather than an
×3 array of values.
- ListDensityPlot[list,DataRange->All] always takes list to represent an array of values.
- 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.
- ListDensityPlot works with SparseArray objects.
- 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 - 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 allBasic Examples (3)
Scope (14)
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 (6)
Provide an interactive Tooltip for the density:
Use a theme with simple ticks and a legend in a bold color scheme:
Options (66)
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)
ColorFunction (5)
ColorFunctionScaling (1)
Get the natural range of values by setting ColorFunctionScaling to False:
DataRange (4)
InterpolationOrder (5)
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)
MeshFunctions (3)
MeshStyle (3)
PerformanceGoal (2)
PlotLegends (5)
PlotRange (2)
PlotTheme (2)
RegionFunction (4)
The region depends on DataRange:
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:
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)
Neat Examples (1)
Text
Wolfram Research (1988), ListDensityPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/ListDensityPlot.html (updated 2017).
BibTeX
BibLaTeX
CMS
Wolfram Language. 1988. "ListDensityPlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/ListDensityPlot.html.
APA
Wolfram Language. (1988). ListDensityPlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ListDensityPlot.html