# ListSliceContourPlot3D with non-opaque stacked planes

I'd like to make a ListSliceContourPlot3D in Mathematica with using the stacked planes (x, y, or z) for the contours, but I'd like the planes to have an opacity < 1, so one can partially see through the plane to the next one down. I've tried setting the opacity and it doesn't look like an option for that plot type. Still, I'm hoping there is a way.

I took this code out of the examples given in ListSliceContourPlot3D . I only added the option BaseStyle -> Opacity[.6].

data = Table[x + y + z, {z, -1, 1, 0.2}, {y, -1, 1, 0.2}, {x, -1, 1, 0.2}];

Table[
ListSliceContourPlot3D[data, sl,
BaseStyle -> Opacity[.6],
PlotLabel -> sl],
{sl, {"XStackedPlanes", "YStackedPlanes", "ZStackedPlanes"}}]


Here are two additional ways to do this.

## 1. ContourShading

ContourShading is an option for ListContourPlot3D that allows one to specify graphics directives for each contour surface. However, such directives have to be specified explicitly, so I found it rather awkward to use:

Table[
ListSliceContourPlot3D[
data,
sl,
ContourShading -> (Directive[#, [email protected]] & /@ ColorData[35, "ColorList"]),
PlotLabel -> sl],
{sl, {"XStackedPlanes", "YStackedPlanes", "ZStackedPlanes"}}]


The advantage here is that one can use a well-documented Mathematica plot option. The disadvantage is that it is (in my opinion) clunky. (Since only the option value Automatic defaults to the ColorFunction, in other cases the color has to be specifically provided for each directive, which makes using a color function messy, as it has to be appropriately scaled and sampled. Here, I just used a discrete list.)

### 2. Postprocessing

One can also change the properties of the Polygons making up the contour filling after the plot has been made. It is matter of finding the relevant parts of the produced plot and changing them. In this case, we want to make all the polygons opaque, so after some digging around, we find that they are all in GraphicsGroup constructions, so we try the following:

Table[
ListSliceContourPlot3D[
data,
sl,
PlotLabel -> sl] /. g_GraphicsGroup :> Sequence[[email protected], g],
{sl, {"XStackedPlanes", "YStackedPlanes", "ZStackedPlanes"}}]


This method has the advantage that all of the properties of the original plot are preserved. The disadvantage is that one has to do a little spelunking into the innards of the plot, but after some practice, it is not so bad.

• For ListSliceContourPlot3D (and all List* plots), you don't need Evaluate, you just need to wrap it parentheses to get the correct precedence. Commented Feb 22, 2016 at 19:19
• @rcollyer Good to know! Commented Feb 23, 2016 at 22:55