View source: R/partial_colour_ramp.R
partial_colour_ramp | R Documentation |
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.
partial_colour_ramp(amount = double(), from = "white")
amount |
Numeric vector between |
from |
Character vector giving colours to ramp from. |
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.
A vctrs::rcrd of class "ggdist_partial_colour_ramp"
with fields
"amount"
and "from"
.
Matthew Kay
Other colour ramp functions:
guide_rampbar()
,
ramp_colours()
,
scale_colour_ramp
pcr = partial_colour_ramp(c(0, 0.25, 0.75, 1), "red")
pcr
ramp_colours("blue", pcr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.