I'm trying to represent the absolute density of a 2-variable scalar function by color and tranparency/opacity. By absolute denstiy, I mean the absolute function value. I tried to do the coloring as follows, but don't know how to give one color for positive values and the other for negative values. The following plot has automatically scaled color and looks okay, only because the function is symmetrical.
DensityPlot[
Cos[x] + Cos[y], {x, -2 Pi, 2 Pi}, {y, -2 Pi, 2 Pi},
ColorFunction -> (Blend[{Blue, Yellow}, LogisticSigmoid[#]] &),
ColorFunctionScaling -> False
]
What I want to do further is to add opacity based on the absolute value. When the density function has low absolute value (whether positve or negative) in some region, then the region must be transparent relatively more than regions that have higer absolute value. And completely transparent when absolute value is 0. I tried using OpacityFunction
but that didn't work.
I think one could color positive and negative regions with dintinct colors (monotonically, without concerning values), then add absolute opacity. That will consequently make regions with lower value less intense. Ultimately, I want to Blend
such plots.