Wolfram Language

Volume Visualization

Mega-Density Plot

Create a 3D density plot of a function, with the extreme values the most opaque.

In[1]:=
Click for copyable input
density = DensityPlot3D[ Sin[\[Pi] x] Sin[\[Pi] y] Sin[\[Pi] z], {x, -2, 2}, {y, -2, 1}, {z, -2, 1}, ColorFunction -> (Blend[{RGBColor[1, 0, 0], RGBColor[ 1, 1, 0]}, #] &), OpacityFunction -> Function[f, If[Abs[f] > .5, .22, .01]], OpacityFunctionScaling -> False, PlotTheme -> "Minimal"]
Out[1]=

Plot the same function on surfaces slicing through the region.

In[2]:=
Click for copyable input
slices = SliceDensityPlot3D[ Sin[\[Pi] x] Sin[\[Pi] y] Sin[\[Pi] z], {z == y, x == y, x == -y}, {x, -2, 2}, {y, -2, 1}, {z, -2, 1}, BoundaryStyle -> Directive[GrayLevel[1, .5], AbsoluteThickness[1]], ColorFunction -> (Abs[#] &), PlotPoints -> 60, PlotTheme -> "Minimal"]
Out[2]=

Combine the two plots into a mega-density plot.

In[3]:=
Click for copyable input
Rasterize[Show[density, slices, ImageSize -> 400]]
Out[3]=

Related Examples

de es fr ja ko pt-br ru zh