({{, (RefLink[SliceContourPlot3D, paclet:ref/SliceContourPlot3D])[f,surf,{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])},{z,(Subscript[z, min]),(Subscript[z, max])}] 
generates a contour plot of f over the slice surface surf as a function of x, y, and z.}, {, (RefLink[SliceContourPlot3D, paclet:ref/SliceContourPlot3D])[f,surf,{x,y,z}∈reg]
restricts the surface to be within region reg.}, {, (RefLink[SliceContourPlot3D, paclet:ref/SliceContourPlot3D])[f,{(Subscript[surf, 1]),(Subscript[surf, 2]),…},…]
generates contour plots over several slices. }})

OpenersNotesSection(Spacer1)Details and Options

The following basic slice surfaces (Subscript[surf, i]) can be given:

(RefLink[SliceContourPlot3D, paclet:ref/SliceContourPlot3D])[f,{x,(Subscript[x, min]),(Subscript[x, max])},…] is equivalent to (RefLink[SliceContourPlot3D, paclet:ref/SliceContourPlot3D])[f,(RefLink[Automatic, paclet:ref/Automatic]),{x,(Subscript[x, min]),(Subscript[x, max])},…] etc.

The following parametrizations can be used for basic slice surfaces:

"YStackedPlanes", "ZStackedPlanes" follow the specifications for "XStackedPlanes", with additional features shown in the scope examples.

The following general slice surfaces (Subscript[surf, i]) can be used:

The following wrappers can be used for slice surfaces (Subscript[surf, i]):

(RefLink[SliceContourPlot3D, paclet:ref/SliceContourPlot3D]) has the same options as (RefLink[Graphics3D, paclet:ref/Graphics3D]), with the following additions and changes:

(RefLink[ColorFunction, paclet:ref/ColorFunction]) is by default supplied with the scaled value of f.

(RefLink[RegionFunction, paclet:ref/RegionFunction]) is by default supplied with x, y, z and f.

OpenersPrimaryExamplesSection(Spacer1)Examples  (92)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Plot the contours of the function exp(-((x^2)+(y^2)+(z^2))) over slice planes through the center:

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]

Plot the contours over the surface (x^3)+(y^2)-(z^2)==0:

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],x^3+y^2-z^2==0,{x,-2,2},{y,-2,2},{z,-2,2}]

OpenersExampleSection1(Spacer1)Scope  (22)

OpenersExampleSubsection0(Spacer1)Surfaces  (9)

Generate a contour plot over standard slice surfaces:

Table[SliceContourPlot3D[Sin[x]+y^2-z^3,sl,{x,-1,1},{y,-1,1},{z,-1,1},PlotLabel->sl],{sl,{"CenterPlanes","BackPlanes","DiagonalStackedPlanes"}}]

Standard axis-aligned stacked slice surfaces:

Table[SliceContourPlot3D[Sin[x]+y^2-z^3,sl,{x,-1,1},{y,-1,1},{z,-1,1},PlotLabel->sl],{sl,{"XStackedPlanes","YStackedPlanes","ZStackedPlanes"}}]

Standard boundary surfaces:

Table[SliceContourPlot3D[Sin[x]+y^2-z^3,sl,{x,-1,1},{y,-1,1},{z,-1,1},PlotLabel->sl],{sl,{"CenterSphere","CenterCutSphere","CenterCutBox"}}]

Plot the contours over any surface region:

SliceContourPlot3D[x+y+z,HalfPlane[{{0,0,0},{1,0,0}},{0,1,1}],{x,-1,1},{y,-1,1},{z,-1,1}]

Plotting over a volume primitive is equivalent to plotting over (RefLink[RegionBoundary, paclet:ref/RegionBoundary])[reg]:

SliceContourPlot3D[x+y+z,Cylinder[],{x,-1,1},{y,-1,1},{z,-1,1}]

Plot the contours over the surface (x^3)+(y^2)-(z^2)==0:

SliceContourPlot3D[Sin[x y z],x^3+y^2-z^2==0,{x,-2,2},{y,-2,2},{z,-2,2}]

Plot the contours over multiple surfaces:

SliceContourPlot3D[Sin[x y z],{Cylinder[],"BackPlanes"},{x,-2,2},{y,-2,2},{z,-2,2},Contours->3]

Specify the number of stacked planes:

SliceContourPlot3D[x+y+z,{"XStackedPlanes",7},{x,-2,2},{y,-2,2},{z,-2,2}]

Specify the cutting angle for a center-cut sphere slice:

SliceContourPlot3D[Sin[x y z],{"CenterCutSphere",2Pi/3},{x,-2,2},{y,-2,2},{z,-2,2}]

OpenersExampleSubsection1(Spacer1)Sampling  (4)

Use (RefLink[Contours, paclet:ref/Contours]) to specify the number of contours:

SliceContourPlot3D[x+y+z,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->5]

Or the list of function values f(x,y,z)==val to put contours:

SliceContourPlot3D[x+y+z,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->{-1,0,1}]

Areas where the function becomes nonreal are excluded:

SliceContourPlot3D[Sqrt[x y z],"CenterSphere",{x,-1,1},{y,-1,1},{z,-1,1}]

Use (RefLink[RegionFunction, paclet:ref/RegionFunction]) to expose obscured slices:

SliceContourPlot3D[x^2+y^2+z^2,"ZStackedPlanes",{x,-2,2},{y,-2,2},{z,-2,2},RegionFunction->Function[{x,y,z},x<0||y>0]]

The domain may be specified by a region including (RefLink[Cone, paclet:ref/Cone]):

SliceContourPlot3D[x+y+z,"CenterPlanes",{x,y,z}∈Cone[]]

A formula region including (RefLink[ImplicitRegion, paclet:ref/ImplicitRegion]):

ℛ=ImplicitRegion[(x^2+(9/4)y^2+z^2-1)^3-x^2z^3-(9/80)y^2z^3<=0,{{x,-1.2,1.2},{y,-0.7,0.7},{z,-1,1.3}}];

SliceContourPlot3D[x+y+z,"CenterPlanes",{x,y,z}∈ℛ]

A mesh-based region including (RefLink[BoundaryMeshRegion, paclet:ref/BoundaryMeshRegion]):

ℛ=ConvexHullMesh[RandomReal[1,{25,3}]]

SliceContourPlot3D[x+y+z,"CenterPlanes",{x,y,z}∈ℛ]

OpenersExampleSubsection2(Spacer1)Presentation  (9)

Use (RefLink[PlotTheme, paclet:ref/PlotTheme]) to immediately get overall styling:

Table[SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1},PlotLabel->t,PlotTheme->t],{t,{"Minimal","Scientific","Marketing"}}]

Use (RefLink[PlotLegends, paclet:ref/PlotLegends]) to get a color bar for the different values:

SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1},PlotLegends->Automatic]

Control the display of axes with (RefLink[Axes, paclet:ref/Axes]):

Table[SliceContourPlot3D[x+y+z,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PlotLabel->a,Axes->a],{a,{True,False,{True,False,True}}}]

Label axes using (RefLink[AxesLabel, paclet:ref/AxesLabel]) and the whole plot using (RefLink[PlotLabel, paclet:ref/PlotLabel]):

SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Ticks->None,AxesLabel->{x,y,z},PlotLabel->x^2+y^2+z^2]

Color the plot by the function values with (RefLink[ColorFunction, paclet:ref/ColorFunction]):

Table[SliceContourPlot3D[Sin[3x y z],"ZStackedPlanes",{x,-1,1},{y,-1,1},{z,-1,1},PlotLabel->c,ColorFunction->c],{c,{Hue,"BlueGreenYellow"}}]

Style regions between contours with (RefLink[ContourShading, paclet:ref/ContourShading]):

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1},Contours->9,BoundaryStyle->None,ContourShading->{Orange,None,Blue}]

Use (RefLink[ContourStyle, paclet:ref/ContourStyle]) to style the contour lines:

SliceContourPlot3D[x^4+y^4+z^4-x^2-y^2-z^2,"CenterSphere",{x,-1,1},{y,-1,1},{z,-1,1},ContourStyle->Dotted]

Style the slice surface boundaries with (RefLink[BoundaryStyle, paclet:ref/BoundaryStyle]):

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},BoundaryStyle->Gray]

(RefLink[TargetUnits, paclet:ref/TargetUnits]) specifies which units to use in the visualization:

SliceContourPlot3D[Quantity[-(x^2+y^2+z^2),"kg/m^3"],"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},AxesLabel->Automatic,PlotLegends->Automatic,TargetUnits->{"Feet","Feet","Feet","g/ft^3"}]

OpenersExampleSection2(Spacer1)Options  (45)

OpenersExampleSubsection3(Spacer1)Axes  (3)

Axes are drawn by default:

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]

Use (RefLink[Axes, paclet:ref/Axes])->(RefLink[False, paclet:ref/False]) to remove the axes:

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Axes->False]

Draw only some axes:

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Axes->{False,False,True}]

OpenersExampleSubsection4(Spacer1)AxesLabel  (4)

No axes labels are drawn by default:

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]

Label axes based on variables specified in (RefLink[SliceContourPlot3D, paclet:ref/SliceContourPlot3D]):

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},AxesLabel->Automatic]

Label the z axis:

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},AxesLabel->"height"]

Use specific labels for each axis:

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},AxesLabel->{"width","depth","height"}]

OpenersExampleSubsection5(Spacer1)BoundaryStyle  (1)

Style the slice surface boundaries with (RefLink[BoundaryStyle, paclet:ref/BoundaryStyle]):

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},BoundaryStyle->Gray]

OpenersExampleSubsection6(Spacer1)BoxRatios  (3)

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

SliceContourPlot3D[x y z,"CenterSphere",{x,0,1},{y,0,1},{z,-1,2}]

Use (RefLink[BoxRatios, paclet:ref/BoxRatios])->(RefLink[Automatic, paclet:ref/Automatic]) to show the natural scale of the 3D coordinate values:

SliceContourPlot3D[x y z,"CenterSphere",{x,0,1},{y,0,1},{z,-1,2},BoxRatios->Automatic]

Use custom length ratios for each side of the bounding box:

SliceContourPlot3D[x y z,"CenterSphere",{x,0,1},{y,0,1},{z,-1,2},BoxRatios->{1,2,2}]

OpenersExampleSubsection7(Spacer1)ClippingStyle  (2)

Color clipped regions:

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PlotRange->{0.09,0.72},ClippingStyle->{Gray,Green}]

Remove clipped regions with (RefLink[None, paclet:ref/None]):

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PlotRange->{0.09,0.72},ClippingStyle->None]

OpenersExampleSubsection8(Spacer1)ColorFunction  (3)

Color the contours according to the f values:

SliceContourPlot3D[x+y z,"ZStackedPlanes",{x,-1,1},{y,-1,1},{z,-1,1},ColorFunction->Hue]

Use a named color gradient:

SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->"IslandColors"]

Use red when f<0:

SliceContourPlot3D[Sin[2 x y z],"ZStackedPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->Function[f,If[f<0,Red,Green]],
ColorFunctionScaling->False,Contours->3]

OpenersExampleSubsection9(Spacer1)ColorFunctionScaling  (2)

By default, scaled values are used:

SliceContourPlot3D[x y z,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->Hue]

Use (RefLink[ColorFunctionScaling, paclet:ref/ColorFunctionScaling])->(RefLink[False, paclet:ref/False]) to get unscaled values:

SliceContourPlot3D[x y z,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->(If[#<=0,Red,Green]&),ColorFunctionScaling->False]

OpenersExampleSubsection10(Spacer1)Contours  (4)

Use 5 equally spaced contours:

SliceContourPlot3D[x^3+y^2-z^2,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->5]

Use automatic contour selection:

SliceContourPlot3D[x^3+y^2-z^2,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->Automatic]

Specify an explicit set of contours:

SliceContourPlot3D[x^3+y^2-z^2,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->{-1,1}]

Use specific contours with specific styles:

SliceContourPlot3D[x^3+y^2-z^2,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->{{-1,Green},{1,Dashed}}]

OpenersExampleSubsection11(Spacer1)ContourStyle  (1)

Specify a style for all contours:

SliceContourPlot3D[x^2+y^2+z^2,"ZStackedPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ContourStyle->Red]

OpenersExampleSubsection12(Spacer1)ContourShading  (4)

(RefLink[ContourShading, paclet:ref/ContourShading])->(RefLink[Automatic, paclet:ref/Automatic]) computes contour region shading from the (RefLink[ColorFunction, paclet:ref/ColorFunction]):

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1},Contours->9,BoundaryStyle->None,ContourShading->Automatic,ColorFunction->"BrightBands"]

Cyclically repeat shading styles:

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1},Contours->9,BoundaryStyle->None,ContourShading->{Orange,Blue}]

Leave every third contour region empty, starting from the second:

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1},Contours->9,BoundaryStyle->None,ContourShading->{Orange,None,Blue}]

Leave the regions between contours blank:

SliceContourPlot3D[Exp[-(x^2+y^2+z^2)],"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1},Contours->9,BoundaryStyle->None,ContourShading->None]

OpenersExampleSubsection13(Spacer1)PerformanceGoal  (2)

Generate a higher-quality plot:

Timing[SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PerformanceGoal->"Quality"]]

Emphasize performance, possibly at the cost of quality:

Timing[SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PerformanceGoal->"Speed"]]

OpenersExampleSubsection14(Spacer1)PlotLegends  (4)

Add a color bar for the different values:

SliceContourPlot3D[Sin[x]Sin[y]Sin[z],"BackPlanes",{x,-1,1},{y,-1,1},{z,-1,1},PlotLegends->Automatic]

(RefLink[PlotLegends, paclet:ref/PlotLegends]) automatically picks up (RefLink[Contours, paclet:ref/Contours]) and (RefLink[ContourShading, paclet:ref/ContourShading]) values:

SliceContourPlot3D[Sin[x]Sin[y]Sin[z],"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ContourShading->{Red,Green,Blue,Yellow},Contours->3,PlotLegends->Automatic]

With the setting (RefLink[ContourShading, paclet:ref/ContourShading])->(RefLink[Automatic, paclet:ref/Automatic]), the colors are derived from (RefLink[ColorFunction, paclet:ref/ColorFunction]):

SliceContourPlot3D[Sin[x]Sin[y]Sin[z],"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->"Rainbow",PlotLegends->Automatic]

Control placement of the legend with (RefLink[Placed, paclet:ref/Placed]):

SliceContourPlot3D[Sin[x]Sin[y]Sin[z],"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PlotLegends->Placed[Automatic,Above]]

OpenersExampleSubsection15(Spacer1)PlotPoints  (1)

Use more plot points to get a smoother contour:

Table[SliceContourPlot3D[-(x^2+y^2+z^2),"BackPlanes",{x,-1,1},{y,-1,1},{z,-1,1},Axes->False,Boxed->False,PlotPoints->pp],{pp,{3,5,20}}]

OpenersExampleSubsection16(Spacer1)PlotRange  (3)

Show (RefLink[All, paclet:ref/All]) contours by default:

SliceContourPlot3D[Sin[3x y z],"CenterSphere",{x,-1,1},{y,-1,1},{z,-1,1}]

Show a select range:

SliceContourPlot3D[Sin[3x y z],"CenterSphere",{x,-1,1},{y,-1,1},{z,-1,1},PlotRange->{All,All,{0,2}},BoxRatios->Automatic]

Show only function values between 0 and 2:

SliceContourPlot3D[x+y+z,"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1},PlotRange->{0,2}]

This is equivalent to the fully qualified form:

SliceContourPlot3D[x+y+z,"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1},PlotRange->{All,All,All,{0,2}}]

OpenersExampleSubsection17(Spacer1)PlotTheme  (3)

Use a theme with detailed grid lines, ticks, and legends:

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PlotTheme->"Detailed"]

Any option setting overrides (RefLink[PlotTheme, paclet:ref/PlotTheme]) settings, in this case removing face grids:

SliceContourPlot3D[-(x^2+y^2+z^2),"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PlotTheme->"Detailed",FaceGrids->None]

Compare different plot themes:

Table[SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PlotLabel->t,PlotTheme->t,ImageSize->130],{t,{"Scientific","Monochrome","Minimal","Web","Working","Classic","Business","Marketing","Detailed"}}]

OpenersExampleSubsection18(Spacer1)RegionFunction  (2)

Include only the contours where x<0 or y>0:

SliceContourPlot3D[x^2+y^2+z^2,"ZStackedPlanes",{x,-2,2},{y,-2,2},{z,-2,2},RegionFunction->Function[{x,y,z,f},x<0||y>0]]

Include only the contours where f>2:

SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},RegionFunction->Function[{x,y,z,f},f>2]]

OpenersExampleSubsection19(Spacer1)TargetUnits  (2)

Axes and legends are labeled with the units specified by (RefLink[TargetUnits, paclet:ref/TargetUnits]):

SliceContourPlot3D[-(x^2+y^2+z^2),"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},AxesLabel->Automatic,PlotLegends->Automatic,TargetUnits->{"Meters","Meters","Meters","kg/m^3"}]

Units specified by (RefLink[Quantity, paclet:ref/Quantity]) are converted to those specified by (RefLink[TargetUnits, paclet:ref/TargetUnits]):

SliceContourPlot3D[Quantity[-(x^2+y^2+z^2),"kg/m^3"],"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2},PlotLegends->Automatic,TargetUnits->"g/ft^3"]

OpenersExampleSubsection20(Spacer1)WorkingPrecision  (1)

Evaluate functions using machine-precision arithmetic:

SliceContourPlot3D[Sin[x y z+10^16],"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]

OpenersExampleSection3(Spacer1)Applications  (17)

OpenersExampleSubsection21(Spacer1)Elementary Functions  (4)

Plot the function f(x,y,z)=x:

SliceContourPlot3D[x,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]

Plot the functions f(x,y,z)=y and f(x,y,z)=z:

{SliceContourPlot3D[y,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}],
SliceContourPlot3D[z,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]}

Plot the functions f(x,y,z)=x+y and f(x,y,z)=y+z:

{SliceContourPlot3D[x+y,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}],
SliceContourPlot3D[y+z,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]}

Plot the functions f(x,y,z)=x+y+z and f(x,y,z)=x-y+z:

{SliceContourPlot3D[x+y+z,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}],
SliceContourPlot3D[x-y+z,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]}

Plot the functions f(x,y,z)=(x^2)+(y^2) and f(x,y,z)=(y^2)+(z^2):

{SliceContourPlot3D[x^2+y^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->5],SliceContourPlot3D[y^2+z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->5]}

Plot the functions f(x,y,z)=(x^2)+(y^2)+(z^2) and f(x,y,z)=(x^2)+(y^2)+2 (z^2):

{SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->5],SliceContourPlot3D[x^2+y^2+2z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->5]}

Plot sin(π x) sin(π y) sin(π z), a product of univariate functions:

surf={{"XStackedPlanes",{-0.5,0.5}},{"ZStackedPlanes",{-0.5,0.5}}};

SliceContourPlot3D[Sin[π x]Sin[π y]Sin[π z],surf,{x,-1,1},{y,-1,1},{z,-1,1},Contours->5]

Plot sin(π x) sin(π (y+z)) and sin(π z) sin(π (x+y)), univariate and bivariate functions:

{SliceContourPlot3D[Sin[π x]Sin[π (y+z)],surf,{x,-1,1},{y,-1,1},{z,-1,1},Contours->5],SliceContourPlot3D[Sin[π (x+y)]Sin[π z],surf,{x,-1,1},{y,-1,1},{z,-1,1},Contours->5]}

Plot sin(π (x+y+z)), a trivariate function:

SliceContourPlot3D[Sin[π (x+y+z)],surf,{x,-1,1},{y,-1,1},{z,-1,1},Contours->5]

Plot a sum of exponentials (∑_i)(Subscript[α, i]) exp(-((Norm[p-(Subscript[p, i])])^2)):

f=Exp[-((Norm[{x,y,z}-{-1,-1,-1}])^2)]+Exp[-((Norm[{x,y,z}-{1,1,1}])^2)];

SliceContourPlot3D[f,{{"XStackedPlanes",{1,-1}},{"YStackedPlanes",{1,-1}},{"ZStackedPlanes",{-1,1}}},{x,-3,3},{y,-3,3},{z,-3,3},Contours->5,PlotRange->{0.1,1.1}]

Pick the points (Subscript[p, i]) randomly in a box:

f=Sum[Exp[-2((Norm[{x,y,z}-pi])^2)],{pi,RandomPoint[Cuboid[{-1,-1,-1},{1,1,1}],10]}];

SliceContourPlot3D[f,"CenterPlanes",{x,-3,3},{y,-3,3},{z,-3,3},Contours->5,PlotRange->{0.1,4}]

OpenersExampleSubsection22(Spacer1)Distribution Functions  (6)

Plot the (RefLink[PDF, paclet:ref/PDF]) of a distribution:

𝒟=MultinormalDistribution[{0,0,0},{{1,0.5,0},{0.5,1,0},{0,0,1}}];
f=PDF[𝒟,{x,y,z}];

d=SliceContourPlot3D[f,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->(ColorData["SunsetColors"][1-#]&)]

Simulate the distribution and show point distribution:

pts=RandomVariate[𝒟,10^4];

Show[d,Graphics3D[{Green,AbsolutePointSize[1],Point[pts]}]]

Plot the (RefLink[CDF, paclet:ref/CDF]) of a distribution:

𝒟=MultinormalDistribution[{0,0,0},{{1,0.5,0},{0.5,1,0},{0,0,1}}];
cdf=CDF[𝒟,{x,y,z}];

SliceContourPlot3D[cdf,{x==y,x==2,y==2},{x,-2,2},{y,-2,2},{z,-1,2},Contours->5,PlotRange->{0.1,1}]

The (RefLink[SurvivalFunction, paclet:ref/SurvivalFunction]):

sf=SurvivalFunction[𝒟,{x,y,z}];

SliceContourPlot3D[sf,{x==y,x==-2,y==-2},{x,-2,2},{y,-2,2},{z,-1,2},Contours->5,PlotRange->{0.1,1}]

The (RefLink[HazardFunction, paclet:ref/HazardFunction]):

hf=HazardFunction[𝒟,{x,y,z}];

SliceContourPlot3D[hf,{x==y,x==2,y==2},{x,-2,2},{y,-2,2},{z,-1,2},Contours->5,PlotRange->{1,8}]

Explore (RefLink[Correlation, paclet:ref/Correlation]) parameters for a (RefLink[MultinormalDistribution, paclet:ref/MultinormalDistribution]), where (Subscript[ρ, ab]) is the correlation between a and b:

cov[{σx_,σy_,σz_},{ρxy_,ρyz_,ρxz_}]:={{((σx)^2),σx σy ρxy,σx σz ρxz},{σx σy ρxy,((σy)^2),σy σz ρyz},{σx σz ρxz,σy σz ρyz,((σz)^2)}};

Correlation between x and y only:

Σ=cov[{1,1,1},{0.5,0,0}];
f=PDF[MultinormalDistribution[{0,0,0},Σ],{x,y,z}];

SliceContourPlot3D[f,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->(ColorData["SunsetColors"][1-#]&)]

Correlation between y and z only:

Σ=cov[{1,1,1},{0,0.5,0}];
f=PDF[MultinormalDistribution[{0,0,0},Σ],{x,y,z}];

SliceContourPlot3D[f,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->(ColorData["SunsetColors"][1-#]&)]

Correlation between y and z only, but larger variance (Subscript[σ, z]^2) in the z component:

Σ=cov[{1,1,2},{0,0.5,0}];
f=PDF[MultinormalDistribution[{0,0,0},Σ],{x,y,z}];

SliceContourPlot3D[f,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-4,4},BoxRatios->Automatic,ColorFunction->(ColorData["SunsetColors"][1-#]&)]

Visualize the (RefLink[PDF, paclet:ref/PDF]) of a (RefLink[ProductDistribution, paclet:ref/ProductDistribution]):

𝒟=ProductDistribution[{NormalDistribution[0,1],3}];
f=PDF[𝒟,{x,y,z}]

SliceContourPlot3D[f,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->(ColorData["SunsetColors"][1-#]&)]

A product of three different distributions:

𝒟=ProductDistribution[NormalDistribution[],LaplaceDistribution[],WeibullDistribution[1,1]];
f=PDF[𝒟,{x,y,z}]

SliceContourPlot3D[f,{{"XStackedPlanes",{0}},{"YStackedPlanes",{0}},{"ZStackedPlanes",{0}}},{x,-2,2},{y,-2,2},{z,0,2},Contours->5,ColorFunction->(ColorData["SunsetColors"][1-#]&)]

A product of bivariate and univariate distributions:

𝒟=ProductDistribution[BinormalDistribution[1/2],ExponentialDistribution[3]];
f=PDF[𝒟,{x,y,z}]

SliceContourPlot3D[f,{x==y,x==-y,z==0},{x,-2,2},{y,-2,2},{z,0,1},ColorFunction->(ColorData["SunsetColors"][1-#]&)]

Plot the pdf of a (RefLink[CopulaDistribution, paclet:ref/CopulaDistribution]):

𝒟=CopulaDistribution[{"Frank",1},{GammaDistribution[3,2/3],ExponentialDistribution[2],NormalDistribution[]}];
f=PDF[𝒟,{x,y,z}]

SliceContourPlot3D[f,{y==0,z==0,{"YStackedPlanes",5}},{x,0,6},{y,0,1.1},{z,-3,3},Contours->7,PlotRange->{0.1,0.4}]

Visualize the (RefLink[PDF, paclet:ref/PDF]) of a kernel density estimate of some trivariate data:

data=RandomVariate[NormalDistribution[],{10^4,3}];
f=PDF[SmoothKernelDistribution[data],{x,y,z}];

SliceContourPlot3D[f,"CenterPlanes",{x,-3,3},{y,-3,3},{z,-3,3},Contours->7,PlotRange->{0.01,0.1}]

OpenersExampleSubsection23(Spacer1)Potential and Wave Functions  (4)

Plot the phase using color on the isosurface of a quadrupole potential:

f=((((x y) Exp[I (((6π)/5)-π (Sqrt[(x^2)+(y^2)+(z^2)]))]) (-1+2 I+((3+I)/(Sqrt[(x^2)+(y^2)+(z^2)]))))/(((x^2)+(y^2)+(z^2)) (Sqrt[(x^2)+(y^2)+(z^2)])));

SliceContourPlot3D[Arg[f],Abs[f]==(Abs[f]/.{x->0.2,y->0.1,z->0.1}),{x,-.25,.25},{y,-.25,.25},{z,-.25,.25},Contours->{0}]

Alternatively, show the 17≤(Abs[f])≤21 on several planes:

SliceContourPlot3D[Abs[f],{"ZStackedPlanes",20},{x,-.25,.25},{y,-.25,.25},{z,-.25,.25},Contours->{17,21},ContourShading->Red,ClippingStyle->None,PlotRange->{All,All,All,{17,21}},BoundaryStyle->None]

Plot spherical waves cos(ω (Norm[p-(Subscript[p, i])])) from three sources (Subscript[p, i]) in space:

f=Sum[Cos[10 Norm[{x,y,z}-{Sin[θ],Cos[θ],0}]],{θ,0,2 π-((2 π)/3),((2 π)/3)}]

SliceContourPlot3D[f,"CenterPlanes",
{x,-2,2},{y,-2,2},{z,-2,2},Contours->3,PlotTheme->"Minimal"]

Plot hydrogen orbital densities for quantum numbers n, m, l:

a0=Quantity["BohrRadius"]/Quantity["Meters"]

ψ[{n_,l_,m_},{r_,θ_,ϕ_}]:=With[{ρ=2r/(n a0)},(Sqrt[((((2/(n a0))))^3)(((n-l-1)!)/(2n(n+l)!))])Exp[-ρ/2](ρ^l)LaguerreL[n-l-1,2l+1,ρ]SphericalHarmonicY[l,m,θ,ϕ]]

Plot (Subscript[ψ, 2,1,0])(x,y,z):

SliceContourPlot3D[(((Abs@ψ[{2,1,0},{(Sqrt[(x^2)+(y^2)+(z^2)]),ArcTan[z,(Sqrt[(x^2)+(y^2)])],ArcTan[x,y]}]))^2),"CenterCutSphere",{x,-5 a0,5 a0},{y,-5 a0,5 a0},{z,-5 a0,5 a0},Contours->5,PlotLegends->Automatic]

Plot (Subscript[ψ, n,m,l])(r,θ,ϕ):

Grid@(Flatten/@Table[SliceContourPlot3D[(((Abs@ψ[{n,l,m},{(Sqrt[(x^2)+(y^2)+(z^2)]),ArcTan[z,(Sqrt[(x^2)+(y^2)])],ArcTan[x,y]}]))^2),"CenterCutSphere",{x,-5 a0,5 a0},{y,-5 a0,5 a0},{z,-5 a0,5 a0},Contours->5,PlotLabel->{n,l,m},Axes->None,Boxed->False,ImageSize->Tiny],{n,1,3},{l,0,n-1},{m,-l,l}])

An electrostatic potential built from a collection of point charges (Subscript[q, i]) at positions (Subscript[p, i]):

ElectroStaticPotential[ql_,pl_,r_] :=Sum[ ((ql[[i]])/(Norm[r-pl[[i]]])), {i,Length[ql]}]

ElectroStaticPotential[{(Subscript[q, 1]),(Subscript[q, 2])},{{(Subscript[x, 1]),(Subscript[y, 1]),(Subscript[z, 1])},{(Subscript[x, 2]),(Subscript[y, 2]),(Subscript[z, 2])}},{x,y,z}]//TraditionalForm

Two charges (Subscript[q, 1])==1 and (Subscript[q, 2])==-1:

p1=SliceContourPlot3D[Evaluate[Clip@ElectroStaticPotential[{1,-1},{{-1,-1,0},{1,1,0}},{x,y,z}]],"ZStackedPlanes",{x,-2,2},{y,-2,2},{z,-2,2},ColorFunction->"Rainbow",PlotLegends->Automatic,PlotPoints->50]

Plot iso charge surfaces:

p2=ContourPlot3D[Evaluate[ElectroStaticPotential[{1,-1},{{-1,-1,0},{1,1,0}},{x,y,z}]],{x,-2,2},{y,-2,2},{z,-2,2},Contours->{-0.3,0,0.3},Mesh->None,ContourStyle->Opacity[0.8]]

Show them together:

Show[p1,p2]

OpenersExampleSubsection24(Spacer1)Partial Differential Equations  (3)

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

L = 4;
usol = NDSolveValue[{D[u[t,x,y], t, t] == D[u[t,x,y], x,x] + D[u[t, x, y], y, y] + Sin[u[t,x,y]], u[t,-L, y] == u[t, L, y], u[t, x, -L] == u[t, x, L], u[0,x, y] == Exp[-(x^2 + y^2)], Derivative[1,0,0][u][0,x,y] == 0}, u, {t,0,L/2}, {x,-L,L},{y,-L,L}]

The solution evolves in time along the z axis:

SliceContourPlot3D[usol[t,x,y],"CenterCutSphere",{x,-L,L},{y,-L,L},{t,0,L/2},AxesLabel->Automatic,PlotLegends->Automatic]

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

usol=NDSolveValue[{D[u[t,x,y],t,t]==D[u[t,x,y],x,x]+D[u[t,x,y],y,y]/2+(1-u[t,x,y]^2)(1+2u[t,x,y]),u[0,x,y]==(E^(-((x^2)+(y^2)))),u[t,-5,y]==u[t,5,y],u[t,x,-5]==u[t,x,5],Derivative[1,0,0][u][0,x,y]==0},u,{t,0,4},{x,-5,5},{y,-5,5}]

SliceContourPlot3D[usol[t,x,y],"CenterCutSphere",{x,-5,5},{y,-5,5},{t,1,4},AxesLabel->Automatic,ColorFunction->"BrightBands",PlotLegends->Automatic]

Visualize solutions to 3D partial differential equations. In this case, a Poisson equation over a (RefLink[Ball, paclet:ref/Ball]) and Dirichlet boundary conditions:

usol = NDSolveValue[{(Subscript[∇, {x,y,z}]^2)u[x,y,z]==1,DirichletCondition[u[x,y,z]==x y z,True]},u,{x,y,z}∈Ball[]]

SliceContourPlot3D[usol[x,y,z],"XStackedPlanes",{x,y,z}∈Ball[]]

OpenersExampleSection4(Spacer1)Properties & Relations  (5)

Use (RefLink[SliceDensityPlot3D, paclet:ref/SliceDensityPlot3D]) for continuous densities on surfaces:

{SliceDensityPlot3D[x^2+y^2+z^2,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}],SliceContourPlot3D[x^2+y^2+z^2,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]}

Use (RefLink[ContourPlot3D, paclet:ref/ContourPlot3D]) for constant value surfaces:

{ContourPlot3D[x^2+y^2+z^2,{x,-2,2},{y,-2,2},{z,-2,2}],SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-2,2},{y,-2,2},{z,-2,2},Contours->3]}

Use (RefLink[DensityPlot3D, paclet:ref/DensityPlot3D]) for full volume visualization of the function values:

{DensityPlot3D[x y z,{x,-2,2},{y,-2,2},{z,-2,2}],SliceContourPlot3D[x y z,"BackPlanes",{x,-2,2},{y,-2,2},{z,-2,2}]}

Use (RefLink[ListSliceContourPlot3D, paclet:ref/ListSliceContourPlot3D]) for data:

data=Table[Sin[x]+y^2-z^3,{z,-1,1,0.1},{y,-1,1,0.1},{x,-1,1,0.1}];

{ListSliceContourPlot3D[data,"BackPlanes"],SliceContourPlot3D[Sin[x]+y^2-z^3,"BackPlanes",{x,-1,1},{y,-1,1},{z,-1,1}]}

Use (RefLink[ContourPlot, paclet:ref/ContourPlot]) for contour plots in 2D:

{ContourPlot[x^2+y^2,{x,-1,1},{y,-1,1}],SliceContourPlot3D[x^2+y^2,"BackPlanes",{x,-1,1},{y,-1,1},{z,-1,1}]}

OpenersExampleSection5(Spacer1)Possible Issues  (1)

Slice surfaces with a constant value may appear noisy:

SliceContourPlot3D[x^2+y^2+z^2,"CenterSphere",{x,-1,1},{y,-1,1},{z,-1,1}]

The function (x^2)+(y^2)+(z^2) is constant on the chosen slice surface:

ContourPlot3D[x^2+y^2+z^2==1,{x,-1,1},{y,-1,1},{z,-1,1}]

Choosing a different slice surface gives a reasonable picture of the function:

SliceContourPlot3D[x^2+y^2+z^2,"CenterPlanes",{x,-1,1},{y,-1,1},{z,-1,1}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ListSliceContourPlot3D, paclet:ref/ListSliceContourPlot3D])  ▪  (RefLink[SliceDensityPlot3D, paclet:ref/SliceDensityPlot3D])  ▪  (RefLink[ContourPlot, paclet:ref/ContourPlot])  ▪  (RefLink[ContourPlot3D, paclet:ref/ContourPlot3D])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Function Visualization, paclet:guide/FunctionVisualization])}, {▪(RefLinkPlain[Solvers over Regions, paclet:guide/GeometricSolvers])}})}})