How to set zero of bicolor ColorData?
You could make your own bi-linear mapping:
myColorFunc = (ColorData["GreenPinkTones"][
Piecewise[{
{Rescale[#, {-30, 0 }, {0, 1/2}], # < 0},
{Rescale[#, {0 , 10}, {1/2, 1}], # >= 0}}]]) &;
BarLegend[{myColorFunc, {-30, 10}},LegendLayout -> "Row"]
Another way to shift the position of a middle color of a gradient uses the "bias" function of Schlick (with suitable rescaling) along with a color gradient. Here is a small demo:
bias[h_, x_] := bias[h, x, {0, 1}];
bias[h_, x_, {a_, b_}] := a + (x - a)/(1 + (1/h - 2) (1 - (x - a)/(b - a)))
Manipulate[DensityPlot[x, {x, -30, 10}, {y, 0, 5}, AspectRatio -> Automatic,
ColorFunction -> Function[x, ColorData[{gradient, {-30, 10}},
bias[h, x, {-30, 10}]]],
ColorFunctionScaling -> False, FrameTicks -> {Automatic, None},
PlotLabel -> Row[{"h=", Round[h, 0.001]}]],
Row[{Control[{{gradient, "GreenPinkTones"}, ColorData["Gradients"],
ControlType -> PopupMenu}],
Control[{{h, 0.5}, 0, 1}]}, Spacer[20]]]
where we see through experimentation that setting h = 0.25
shifts the white color to 0
. To confirm:
Solve[bias[h, 0, {-30, 10}] == bias[1/2, Mean[{-30, 10}], {-30, 10}], h]
{{h -> 1/4}}
Thus, here is the final color function you need:
mycf = ColorData[{"GreenPinkTones", {-30, 10}}, bias[1/4, #, {-30, 10}]] &;
BarLegend[{mycf, {-30, 10}}, LegendLayout -> "Row"]