partial_colour_ramp {ggdist} | R Documentation |
Partial colour ramp (datatype)
Description
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")
Arguments
amount |
Numeric vector between |
from |
Character vector giving colours to ramp 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.
Value
A vctrs::rcrd of class "ggdist_partial_colour_ramp"
with fields
"amount"
and "from"
.
Author(s)
Matthew Kay
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
ramp_colours("blue", pcr)