lgnds = BarLegend[{{Red, White, Blue}, {-1, 1}},
Ticks -> {{-1, Style["-1", 13, Black]}, {0,
Style["0", 13, Black]}, {1, Style["1", 13, Black]}},
LegendMarkerSize -> 150]
DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3},
ColorFunction -> (Blend[{Red, White, Blue}, Rescale[#, {-1, 1}]] &),
ColorFunctionScaling -> False, PlotLegends -> Placed[lgnds, Above]]
In the cod above the White
color in the BarLegend
must be at 0
, why is it shifted?
DensityPlot
seems to be rescaling the legend. Happens withContourPlot
, too. I don't see why it should do that. Probably a bug. $\endgroup$