# Rescale color function of multiple plots

I have 5 ListDensityPlots that are using the same color function but the color bar runs over a different range in every plot. For example here are two of the 5 plots that I have

I want these plots to have the same coloring as the following two plots

I know that I can rescale these plots using the Rescale function but am unsure of how to change the colors so that the colors show up in the same manner as the last two figures. Currently my code without using the Rescale function looks like the following for plotting:

rainbow[z_] := Blend[{Black, Purple, Blue, Green, Yellow, Red}, z]

figure = ListDensityPlot[INSplot, PlotRange -> All, ColorFunction -> rainbow, LabelStyle -> {18, GrayLevel[0], Italic,
FontFamily -> "Helvetica"}, FrameLabel -> {"[H,0,0] (r.l.u)", "[-H,2H,0] (r.l.u)", "3T, E = [0.6, 0.7] meV"},
PlotLegends -> Placed[BarLegend[Automatic,
LegendLabel ->
Placed[Rotate["Intensity (arb.unit.)", 90 Degree], Right
],
LabelStyle -> {18, GrayLevel[0], Italic,
FontFamily -> "Helvetica"}], Right]]


If I understand the question correctly, you need to do two things - turn off ColorFunctionScaling, and then rescale your input before you feed it to your color function. You will need to do the same thing to your legend to get it to display the colors correctly in the range.

rainbow[z_] := Blend[{Black, Purple, Blue, Green, Yellow, Red}, z];
d1 = Table[
Sin[x] + Cos[y], {x, 0, 2 \[Pi], 2 \[Pi]/100}, {y, 0, 2 \[Pi],
2 \[Pi]/100}];
d2 = 10*d1;
mx = Max[Flatten@{d1, d2}]; (*For finding the new scale.*)
mn = Min[Flatten@{d1, d2}]; (*For finding the new scale.*)
ListDensityPlot[
d1
, ColorFunctionScaling -> False
, ColorFunction -> (rainbow[Rescale[#, {0, mx}, {0, 1}]] &)
]

ListDensityPlot[
d2
, ColorFunctionScaling -> False
, ColorFunction -> (rainbow[Rescale[#, {0, mx}, {0, 1}]] &)
]
legend = BarLegend[{rainbow[Rescale[#, {mn, mx}, {0, 1}]] &, {mn, mx}}]


Rescale will rescale your data so that numbers in the range {mn,mx} are now mapped from {0,1}, which is where most color functions reside. This normally happens automatically, rescaling the data to get good coverage from the color function, which is why you have to turn off ColorFunctionScaling.

If a number is larger than mx, or smaller than mn it will be mapped to the appropriate number greater or smaller than 1 and it will clip on your color scale.