Given vectors of colours and partial_colour_ramp
s, ramps the colours
according to the parameters of the partial colour ramps, returning
a vector of the same length as the inputs giving the transformed
(ramped) colours.
ramp_colours(colour, ramp)
<character> Vector of colours to ramp to.
<partial_colour_ramp> Vector of colour ramps (same length as
colour
) giving the colour to ramp from and the amount to ramp.
A character vector of colours.
Takes vectors of colours and partial_colour_ramp
s and produces
colours by interpolating between each from
colour and the target colour
the specified amount
(where amount
and from
are the corresponding
fields of the ramp
).
For example, to add support for the fill_ramp
aesthetic to a geometry,
this line could be used inside the draw_group()
or draw_panel()
method
of a geom:
Other colour ramp functions:
guide_rampbar()
,
partial_colour_ramp()
,
scale_colour_ramp
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"