# DensityPlot3D DensityPlot3D[f,{x,xmin,xmax},{y,ymin,ymax},{z,zmin,zmax}]

makes a density plot of f as a function of x, y, and z.

DensityPlot3D[f,{x,y,z}reg]

takes the variables to be in the geometric region reg.

# Details and Options    • DensityPlot3D is also known as volume map.
• DensityPlot3D evaluates the function over its domain and maps the value to a color and opacity independently.
• The opacity function is typically used to make some range of values visible, while making some others invisible.
• The plot visualizes the set , where is a color function and is an opacity function.
• • At positions where f does not evaluate to a real number, data is taken to be missing and is rendered transparently.
• DensityPlot3D treats the variables x, y, and z as local, effectively using Block.
• DensityPlot3D has attribute HoldAll, and evaluates f only after assigning specific numerical values to x, y, and z.
• In some cases it may be more efficient to use Evaluate to evaluate f symbolically before specific numerical values are assigned to x, y, and z.
• DensityPlot3D has the same options as Graphics3D, with the following additions and changes:
•  Axes True whether to draw axes BoxRatios {1,1,1} bounding 3D box ratios ColorFunction Automatic how to color the plot ColorFunctionScaling True whether to scale the arguments to ColorFunction OpacityFunction Automatic how to compute the opacity at each point OpacityFunctionScaling True whether to scale the arguments to OpacityFunction PerformanceGoal \$PerformanceGoal aspects of performance to optimize PlotLegends None legends for color gradients PlotPoints Automatic initial number of samples for the function in each direction PlotRange {Full,Full,Full,Automatic} range of f or other values to include 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 TargetUnits Automatic desired units to use WorkingPrecision MachinePrecision the precision used in internal computations
• ColorFunction and OpacityFunction are supplied with a single argument, given by default by the scaled value of f.
• Typical settings for OpacityFunction include:
•  Automatic automatically determined None no opacity function, fully opaque α constant opacity Opacity[α] Interval[…] make values in the interval more opaque "Image3D" default opacity function used in Image3D func general opacity function
• The arguments supplied to RegionFunction are x, y, z, and f.
• Possible settings for ScalingFunctions include:
•  sf scale the fcontour values {sx,sy,sz} scale x, y and z axes {sx,sy,sz,sf} scale x, y and z axes and fcontour values
• Common built-in scaling functions s include:
•  "Log" log scale with automatic tick labeling "Log10" base-10 log scale with powers of 10 for ticks "SignedLog" log-like scale that includes 0 and negative numbers "Reverse" reverse the coordinate direction "Infinite" infinite scale

# Examples

open allclose all

## Basic Examples(3)

Plot a 3D function:

Plot a function over a ball:

Use a different color scheme and legend:

## Scope(13)

### Sampling(6)

Areas where the function becomes nonreal are excluded:

Use PlotPoints to control sampling:

The domain may be specified by a region including Cone:

A formula region including ImplicitRegion:

A mesh-based region including BoundaryMeshRegion:

Use PlotRange to limit ranges to expose more detail:

Use ClipPlanes to specify one or several clipping planes. In this case, clip :

Use RegionFunction to constrain point inclusion more generally:

### Presentation(7)

Use PlotTheme to immediately get overall styling:

Use PlotLegends to get a color bar for the different values:

Control the display of axes with Axes:

Label axes using AxesLabel and the whole plot using PlotLabel:

Color the plot by the function values with ColorFunction:

TargetUnits specifies which units to use in the visualization:

Use a log scale for the axis:

Reverse the axis so that values increase as they go down:

## Options(39)

### BoxRatios(2)

By default, the edges of the bounding box have the same length:

Use to show the natural scale of the 3D coordinate values:

### ClipPlanes(3)

Use ClipPlanes to specify one or several clipping planes. In this case, clip :

Specify several clip planes, in this case clipping and :

Compare to the general RegionFunction:

### ColorFunction(1)

Color the function according to the x, y, z, or f values:

### ColorFunctionScaling(2)

Parameters to ColorFunction are normally scaled to be between 0 and 1:

Use unscaled density values by setting ColorFunctionScaling to False:

### OpacityFunction(6)

OpacityFunction is Automatic by default:

Turn off transparency with :

Make values in the intervals and more opaque:

Use a constant opacity Opacity[0.05]:

Use the same opacity function as the one used in Image3D:

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

### OpacityFunctionScaling(3)

By default, scaled values are used:

Use unscaled density values by setting OpacityFunctionScaling to False:

Specify an unscaled opacity interval:

### PerformanceGoal(2)

Generate a higher-quality plot:

Emphasize performance, possibly at the cost of quality:

### PlotLegends(2)

No legends are used by default:

Use to show a legended plot:

### PlotPoints(2)

Use more points to get a smoother density:

Use 2 points in the direction, 4 in the direction, and 8 in the direction:

### PlotRange(3)

Show the density plot over the full , , range:

Show only function values between 0 and 1:

Equivalently, the full specification:

### PlotTheme(3)

Use a plot theme:

Option settings override theme settings, in this case removing face grids:

Compare different plot themes:

### RegionFunction(3)

Plot over a ball in , , and :

Show only areas where :

Regions do not have to be connected:

### ScalingFunctions(4)

By default, DensityPlot3D has linear scales in all directions:

Create a plot with a log-scaled axis:

Use ScalingFunctions to reverse the coordinate direction in the direction:

Use an scale defined by a function, specifying the function and its inverse:

### TargetUnits(2)

Axes and legends are labeled with the units specified by TargetUnits:

Units specified by Quantity are converted to those specified by TargetUnits:

### WorkingPrecision(1)

Evaluate functions using machine-precision arithmetic:

## Applications(17)

### Elementary Functions(4)

Plot the function :

Plot the functions and :

Plot the functions and :

Plot the functions and :

Plot the functions and :

Plot the functions and :

Plot , a product of univariate functions:

Plot and , univariate and bivariate functions:

Plot , a trivariate function:

Plot a sum of exponentials :

Pick the points randomly in a box:

### Distribution Functions(6)

Plot the PDF of a distribution:

Simulate the distribution and show point distribution:

Plot the CDF of a distribution:

The SurvivalFunction:

The HazardFunction:

Explore Correlation parameters for a MultinormalDistribution, where ρab is the correlation between a and b:

Correlation between x and y only:

Correlation between y and z only:

Correlation between y and z only, but larger variance in the z component:

Visualize the PDF of a ProductDistribution:

A product of three different distributions:

A product of bivariate and univariate distributions:

Plot the PDF of a CopulaDistribution:

Visualize the PDF of a kernel density estimate of some trivariate data:

Use ClipPlanes to see through the middle:

### Partial Differential Equations(3)

Visualize a nonlinear sine-Gordon equation in two spatial dimensions with periodic boundary conditions, with time represented along the axis:

The solution evolves in time along the axis:

A cross-sectional view:

Visualize Wolfram's nonlinear wave equation in two spatial dimensions with time represented along the axis:

A cross-sectional view:

Visualize solutions to 3D partial differential equations. In this case, a Poisson equation over a Ball and Dirichlet boundary conditions:

Plot it:

### Potential and Wave Functions(4)

Visualize a field of randomly placed charges:

Plot spherical waves from three sources in space:

Plot hydrogen orbital densities for quantum numbers , , :

Plot :

## Properties & Relations(5)

Use ListDensityPlot3D for data:

Use DensityPlot for density plots in 2D:

Use SliceDensityPlot3D for density plots over slice surfaces:

Use SliceContourPlot3D for contour plots over slice surfaces:

Use ContourPlot3D for constant value surfaces: