A representation of a partial ramp between two colours: the origin colour
(from) and the distance from the origin colour to the target colour
(amount, a value between 0 and 1). The target colour of the ramp
can be filled in later using ramp_colours(), producing a colour.
Usage
partial_colour_ramp(amount = double(), from = "white")Value
A vctrs::rcrd of class "ggdist_partial_colour_ramp" with fields
"amount" and "from".
Details
This datatype is used by scale_colour_ramp to create ramped colours in
ggdist geoms. It is a vctrs::rcrd datatype with two fields:
"amount", the amount to ramp, and "from", the colour to ramp from.
Colour ramps can be applied (i.e. translated into colours) using
ramp_colours(), which can be used with partial_colour_ramp()
to implement geoms that make use of colour_ramp or fill_ramp scales.
See also
Other colour ramp functions:
guide_rampbar(),
ramp_colours(),
scale_colour_ramp
Examples
pcr = partial_colour_ramp(c(0, 0.25, 0.75, 1), "red")
pcr
#> <partial_colour_ramp[4]>
#> [1] [0 from red] [0.25 from red] [0.75 from red] [1 from red]
ramp_colours("blue", pcr)
#> [1] "#FF0000" "#E80050" "#9A00C3" "#0000FF"