Description Usage Arguments Details Value References See Also Examples
Functions to define how variables are mapped into color space.
Used for the color_projection argument to
scale_color_colorplane and
scale_fill_colorplane. Custom functions can also be defined
following this signature.
| 1 2 3 4 5 | YUV_projection(x, y, Y = 0.3)
red_blue_projection(x, y)
interpolate_projection(x, y, zero_color, horizontal_color, vertical_color)
 | 
| x, y | numeric vectors of equal length containing the values to be mapped to the horizontal and vertical axes of the colorplane. | 
| Y | numeric value in range 0 to 1 for the fixed luminosity level in YUV projections. | 
| zero_color, horizontal_color, vertical_color | Character strings specifying R colors to use in interpolation projections. See Details. | 
Color space projection functions take two numeric vectors and return
a single character vector of the same length that specifies the colors to
plot in the form "#rrggbb", as returned by rgb.
Additional projection functions can be defined following the same signature
and passed to the color_projection argument of the
scale_*_colorplane scale constructors. When writing custom
projection functions, expect two arguments that are numeric vectors scaled
to a range of 0 to 1 and that do not contain missing values. Custom
projections can accept additional arguments that are passed through from
the ... of scale_*_colorplane.
For interpolate_projection, a color space is created via
linear RGB-space interpolation for each axis and then blending by averages.
zero_color is the base color when both x and y are
minimal. horizontal_color specified the color to interpolate towards
for increasing x values and vertical_color for y. The
plotted color will be a simple average of the interpolated x and
y values.
Character vector of colors of the same length as x and
y.
YUV conversion matrix from https://en.wikipedia.org/wiki/YUV. UV limits sourced from Deveroux VG. Limiting of YUV Video Signals. British Broadcasting System. 1987 .
scale_color_colorplane,
scale_fill_colorplane
| 1 2 3 4 5 6 7 | library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg, color = disp, colour2 = hp)) +
  geom_point() +
  scale_color_colorplane(color_projection = interpolate_projection,
                         zero_color = "darkorange2",
                         horizontal_color = "mediumspringgreen",
                         vertical_color = "magenta")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.