I'd need to compare two different DensityPlot by keeping the PlotRange fixed: however I'm not able to do that because DensityPlot automatically fix the range of the plot to the {min,max} of the function. I've been reading something about it, a tried some possible solutions (for example ColorFunctionScaling -> False) but non of them solved my problem.
Here is part of the code I'm using:
DensityPlot[(
E^(-x^2 - y^2) (-1 - 4 x y))/Sqrt[\[Pi]], {x, -4, 4}, {y, -4, 4},
PlotRange -> {Automatic, Automatic, {-0.69, 0.69}},
PlotPoints -> 150,
ColorFunction -> (Blend[{RGBColor[0.02, 1, 1], RGBColor[0, 0.48, 1],
RGBColor[0, 0, 0.73], Black, RGBColor[0.6, 0.22, 0], RGBColor[
1, 0.55, 0], White}, #1] &),
PlotLegends ->
Placed[BarLegend[Automatic, LegendMarkerSize -> 250], Right],
ImageSize -> 300,
Background -> Transparent
]
DensityPlot[(
E^(-x^2 - y^2) (2 x - 2 y))/Sqrt[\[Pi]], {x, -4, 4}, {y, -4, 4},
PlotRange -> {Automatic, Automatic, {-0.69, 0.69}},
PlotPoints -> 150,
ColorFunction -> (Blend[{RGBColor[0.02, 1, 1], RGBColor[0, 0.48, 1],
RGBColor[0, 0, 0.73], Black, RGBColor[0.6, 0.22, 0], RGBColor[
1, 0.55, 0], White}, #1] &),
PlotLegends ->
Placed[BarLegend[Automatic, LegendMarkerSize -> 250], Right],
ImageSize -> 300,
Background -> Transparent
]
and the output is the following:
where obviously the range of the plots is not -0.69:0.69 in both of them. Using the correct color scaling the orange/brown background in the first picture would be black as in the second one.
Any solution for fixing it? Edit: I think the solution lies in using ColorData function in some way: I noticed that, with a standard color function (e.g. "Heat") I can use the combination:
ColorFunctionScaling -> False,
ColorFunction -> ColorData[{"Heat", {-0.69, 0.69}}],
but I'm not able to reproduce it with my custom ColorFunction...