79610193

Date: 2025-05-07 09:32:59
Score: 0.5
Natty:
Report link

Another possibility using transparent color functions,

gaussian[r_, R_, w_ : 1] := Exp[-(r - R) . (r - R)/w]

dat1 = Flatten[#, 1] &@
   Table[{x, y, gaussian[{x, y}, {0, 0}]}, {x, -3, 3, 0.25}, {y, -3, 
     3, 0.1}];

dat2 = Flatten[#, 1] &@
   Table[{x, y, gaussian[{x, y}, {.5, 1.5}, 5]}, {x, -3, 3, 
     0.25}, {y, -3, 3, 0.1}];

mycf1[n_] := Opacity[#, If[n == 1, 
    ColorData["TemperatureMap"][.5 + #/2], 
    ColorData["TemperatureMap"][.5 - #/2]
    ]] &


Show[
 ListDensityPlot[dat2, PlotRange -> All, InterpolationOrder -> 0, 
  ColorFunction -> mycf1[2]] ,
 ListDensityPlot[dat1, PlotRange -> All, InterpolationOrder -> 0, 
  ColorFunction -> mycf1[1]] 
 ]

Here I have just scaled the opacity of the color function so that it goes to zero when the function value is minimum, and chose a color function which is white at the bottom. You still have to be careful to fine-tune things if they are strongly overlapping. Here's some examples

enter image description hereenter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Kai