# plotting – ColorFunctionScaling and OpacityFunctionScaling with values other than 0 and 1

I have a 3D density plot that I was able to get to look okay with setting `ColorFunctionScaling` and `OpacityFunctionScaling` to True. I know that there are other ways to view this data, but I checked the documentation and both these functions treat the minimum value as 0 and the maximum as 1. With the 3D plot, this obscures the middle. Is there a way to have it so that for example, the whole plot is scaled with opacity between 0 and 0.7?

Here is the example I am using. If possible I would also like the color function reduced to between 0 and 1/14.

``````prob1 = (E^(-2 Im(ArcTan(x, y)) - Re(Sqrt(x^2 + y^2 + z^2))) Abs(x^2 + y^2))/(64 (Pi));

P1 =
DensityPlot3D(prob1, {x, -20, 20}, {y, -20, 20}, {z, -20, 20},
AxesLabel -> {"x", "y", "z"}, ColorFunction -> Hue,
OpacityFunction -> Function(a, a^1.2),
ColorFunctionScaling -> True, OpacityFunctionScaling -> True,
FaceGrids -> {{-1, 0, 0}, {0, 1, 0}, {0, 0, -1}},
Ticks -> Table({{-20,"-20a0"}, {-10,"-10a0"}, {0, "0"}, {10,"10a0"}, {20, "20a0"}}, {i, 3}),
PlotLegends -> Automatic)
``````

This yields the above: I’m looking for a way to lower the opacity of the inside of the doughnut in that same kind of exponential function I have, and I want the maximum opacity to be 0.7. The `prob1` function just takes to long to run if I add a `Maximize`. Any suggestions?

Posted on Categories Articles