I find the ColorFunction
in BarLegend
behaves very weirdly:
Force rescaling from 0 to 1
For example:
cf1[z_] := ColorData[{"Temperature", {0, 1}}][z]; BarLegend[{cf1[#] &, {0, .5}}]
gives
Rescaling changes within
MatrixPlot
For example:
MatrixPlot[RandomReal[{1, 4}, {10, 10}], PlotLegends -> BarLegend[{"Temperature", {1, 4}}], ColorFunction -> (ColorData[{"Temperature", {1, 4}}][#] &), ColorFunctionScaling -> False, DataReversed -> True]
gives
However, generating
BarLegend
alone as follows:BarLegend[{"Temperature", {1, 4}}]
gives
Obviously, ColorFunctionScaling
in BarLegend
has been set to False
accordingly as in MatrixPlot
, which is unexpected since I have no control of the scaling inside BarLegend
.
Questions:
Is the auto-rescaling a bug?
Or, how can I "utilize" the feature?