Creates a palette for the current session for a divergent-colour graphic with a non-symmetric range. Based on ideas from Maureen Kennedy, Nick Povak, and Alina Cansler.
divergentColors(
start.color,
end.color,
min.value,
max.value,
mid.value = 0,
mid.color = "white"
)
# S4 method for character,character,numeric,numeric
divergentColors(
start.color,
end.color,
min.value,
max.value,
mid.value = 0,
mid.color = "white"
)
Start colour to be passed to colorRampPalette
.
End colour to be passed to colorRampPalette
.
Numeric minimum value corresponding to start.colour
.
If attempting to change the colour of a RasterLayer
,
this can be set to minFn(RasterObject)
.
Numeric maximum value corresponding to end.colour
.
If attempting to change the colour of a RasterLayer
,
this can be set to maxFn(RasterObject)
.
Numeric middle value corresponding to mid.colour
.
Default is 0
.
Middle colour to be passed to colorRampPalette
.
Defaults to "white"
.
A diverging colour palette.
divergentColors("darkred", "darkblue", -10, 10, 0, "white")
#> [1] "#8B0000" "#961919" "#A23333" "#AD4C4C" "#B96666" "#C47F7F" "#D09999"
#> [8] "#DCB2B2" "#E7CCCC" "#F3E5E5" "#FFFFFF" "#E5E5F3" "#CCCCE7" "#B2B2DC"
#> [15] "#9999D0" "#7F7FC4" "#6565B9" "#4C4CAD" "#3232A2" "#191996" "#00008B"