This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

# DensityPlot

 DensityPlotmakes a density plot of f as a function of x and y.
• DensityPlot by default generates colorized grayscale output, in which larger values are shown lighter.
• At positions where f does not evaluate to a real number, holes are left so that the background to the density plot shows through.
• DensityPlot has attribute HoldAll, and evaluates f only after assigning specific numerical values to x and y.
• In some cases it may be more efficient to use Evaluate to evaluate f symbolically before specific numerical values are assigned to x and y.
• The plot is left blank in any regions where f evaluates to None.
 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 EvaluationMonitor None expression to evaluate at every function evaluation Exclusions Automatic x, y curves to exclude ExclusionsStyle None what to draw at excluded curves Frame True whether to draw a frame around the plot FrameTicks Automatic frame tick marks LightingAngle None effective angle of the simulated light source MaxRecursion Automatic the maximum number of recursive subdivisions allowed 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 refining the plot PerformanceGoal \$PerformanceGoal aspects of performance to try to optimize PlotPoints Automatic the initial number of sample points for the function in each direction PlotRange {Full,Full,Automatic} the range of f or other values to include PlotRangeClipping True whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values RegionFunction (True&) how to determine whether a point should be included WorkingPrecision MachinePrecision the precision used in internal computations
• DensityPlot initially evaluates f at a grid of equally spaced sample points specified by PlotPoints. Then it uses an adaptive algorithm to subdivide at most MaxRecursion times to generate smooth contours.
• You should realize that since it uses only a finite number of sample points, it is possible for DensityPlot to miss features of your functions. To check your results, you should try increasing the settings for PlotPoints and MaxRecursion.
• With the setting Mesh->All, DensityPlot draws mesh lines to show all the subdivisions it uses.
• ColorFunction is supplied with a single argument, given by default by the scaled value of f.
Plot a function:
Use a different color scheme:
Create a contouring overlay mesh:
Plot a function:
 Out[1]=

Use a different color scheme:
 Out[1]=

 Out[1]=

Create a contouring overlay mesh:
 Out[1]=
 Scope   (13)
More points are sampled where the function changes quickly:
The plot range is selected automatically:
Areas where the function becomes nonreal are excluded:
The region is split when there are discontinuities in the function:
Use PlotPoints and MaxRecursion to control adaptive sampling:
Use PlotRange to focus in on areas of interest:
Use Exclusions to remove curves or split the resulting surface:
Use RegionFunction to restrict the surface to a region given by inequalities:
Color the surface by height:
Provide an interactive Tooltip for a surface:
Style the overlay mesh:
Create a contouring overlay mesh:
 Options   (56)
Choose the ratio of height to width from the actual plot values:
Set the ratio to 1:
Draw both and axes:
Use automatically determined axes labels:
Set axes labels explicitly:
Specify the axes origin at the point :
Use a red boundary around the edges of the surface:
BoundaryStyle applies to regions cut by RegionFunction:
BoundaryStyle does not apply to cuts made by Exclusions:
Show clipped regions like the rest of the surface:
Leave clipped regions empty:
Use pink to fill the clipped regions:
Use light red where the surface is clipped above and pink below:
Color by scaled coordinate:
Specify gray-level intensity by scaled coordinate:
Named color gradients color in the direction:
Use brightness to correspond to height or density of a function:
Use the interpolation between two colors to indicate the height or density of a function:
Get the natural range of values by setting ColorFunctionScaling to False:
Show where DensityPlot samples a function:
Count how many times is evaluated:
This uses automatic methods to compute exclusions:
Indicate that no exclusions should be computed:
Give exclusions as an equation:
Give multiple exclusion sets:
Use a condition with the exclusion equation:
Use both automatically computed and explicit exclusions:
Use a red boundary to indicate the excluded curves:
Draw no frame:
Draw frames on the bottom and the left edges only:
Use the independent variable names as FrameLabel:
Refine the function where it changes quickly:
Use no mesh:
Show the initial and final sampling mesh:
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:
Use the value as the mesh function:
Use mesh lines in the and directions:
Use mesh lines corresponding to fixed distances from the origin:
Use red mesh lines:
Use red mesh lines in the direction and dashed mesh lines in the direction:
Generate a higher-quality plot:
Emphasize performance, possibly at the cost of quality:
Use more initial points to get a smoother density:
Use 20 initial points in the direction and 5 in the direction:
Automatically compute the range:
Use all points to compute the range:
Show the surface over the full , range:
Automatically compute the , range:
Use an explicit range to emphasize features:
Plot over an annulus region in and :
Regions do not have to be connected:
Use any logical combination of conditions:
Evaluate functions using machine-precision arithmetic:
Evaluate functions using arbitrary-precision arithmetic:
 Applications   (7)
Plot a sum of five sine waves in random directions:
This shows the solution to the heat equation in one dimension:
Plot a saddle surface; the mesh curves show where the function is zero:
The 1, 2, 3, and norms, with the iso-norm mesh lines at 1/2, 1 and 3/2:
Show argument variation for sin, cos, tan, and cot over the complex plane:
Show the different complex components for a function:
Transform a function to expose more features:
DensityPlot samples more points where it needs to:
Use ContourPlot to get segmented iso curves and contour regions:
Use ListDensityPlot for plotting continuous data:
Use Plot3D to get 3D surfaces:
Add a ColorFunction to get an overlay density:
Use ArrayPlot or MatrixPlot for discrete data:
Use Plot for univariate functions:
Use ParametricPlot for plane parametric curves and regions:
Use ContourPlot3D and RegionPlot3D for implicit surfaces and regions:
With segmenting or piecewise color functions, the transition color borders may not be sharp:
Use ContourPlot for segmenting problems instead:
Color functions or densities that change quickly may show artifacts:
Use PlotPoints to increase the sampling density:
Branch cuts for inverse trigonometric functions:
Real and imaginary part overlay mesh: