Reverse GrayLevel (not same as GrayTones)
I use Blend[{White, Black}, #1] &
Row[{
bl1 = BarLegend[{GrayLevel, {-0.1, 0.1}}],
bl2 = BarLegend[{{"GrayTones", "Reverse"}, {-0.1, 0.1}}],
bl3 = BarLegend[{Blend[{White, Black}, 5 # + 0.5] &, {-0.1, 0.1}}],
bl4 = BarLegend[{Blend[{Black, White}, 5 # + 0.5] &, {-0.1, 0.1}}]
}]
Row[{
BarLegend[{{"MonochromeFractalGradient", "Reverse"}, {-0.1, 0.1}}],
BarLegend[{{White, Black}, {-0.1, 0.1}}],
BarLegend[{GrayLevel[1 - #] &, {-0.1, 0.1}}, ColorFunctionScaling -> True]
}]
None of the other answers mention this, so:
For a color scheme like
"GrayTones"
that belongs to the listColorData["Gradients"]
, one can modify them so that they have a different range from the default of $[0,1]$. In this case, if the dark color of"GrayTones"
(ColorData["GrayTones"][0]
) should correspond to0.1
, and the light color of"GrayTones"
(ColorData["GrayTones"][1]
) should correspond to-0.1
, then one should use something likeColorData[{"GrayTones", {0.1, -0.1}}]
.Functions like
GrayLevel[]
andHue[]
do not have this functionality. Thus, one has to use the built-in function specifically designed for the task,Rescale[]
. Since one wants a mapping from{-0.1, 0.1}
to{1, 0}
(note the order!), thenGrayLevel
should be composed withRescale[x, {-0.1, 0.1}, {1, 0}]
.
Thus:
Row[{bl1 = BarLegend[{GrayLevel, {-0.1, 0.1}}],
bl2 = BarLegend[{{"GrayTones", "Reverse"}, {-0.1, 0.1}}],
bl3 = BarLegend[{ColorData[{"GrayTones", {0.1, -0.1}}], {-0.1, 0.1}}],
bl4 = BarLegend[{ColorData["GrayTones", Rescale[#, {-0.1, 0.1}, {1, 0}]] &,
{-0.1, 0.1}}],
bl5 = BarLegend[{GrayLevel[Rescale[#, {-0.1, 0.1}, {1, 0}]] &, {-0.1, 0.1}}]}]
and we see that the middle three gradients are equivalent.
As a more striking example of the utility of Rescale[]
:
Row[{BarLegend[{Hue, {-0.1, 0.1}}],
BarLegend[{Hue[Rescale[#, {-0.1, 0.1}, {1, 0}]] &, {-0.1, 0.1}}]}]