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

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  (12)

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  (6)

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:

Options  (41)

Axes  (3)

Axes are drawn by default:

Use Axes->False to remove the axes:

Draw only some axes:

AxesLabel  (3)

No axes labels are drawn by default:

Label axes based on variables specified in DensityPlot3D:

Use specific labels for each axis:

BoxRatios  (2)

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

Use BoxRatios->Automatic 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 OpacityFunctionNone:

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 PlotLegends->Automatic 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:

Use specific ranges to show more detail:

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:

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 sum_ialpha_i exp(-TemplateBox[{{p, -, {p, _, i}}}, Norm]^2):

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 cos(omega TemplateBox[{{p, -, {p, _, i}}}, Norm]) from three sources in space:

Plot an acoustic quadrupole:

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:

Introduced in 2015
 (10.2)