## Description

Create objects which describe linear and radial gradients. These objects can later be used to apply a gradient fill to grobs, and also to define a gradient so that it may be reused multiple times.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```linearGradient(col = c("black", "white"), stops = seq(0, 1, length.out = length(col)), gradientUnits = c("bbox", "coords"), x0 = unit(0, "npc"), x1 = unit(1, "npc"), y0 = unit(0, "npc"), y1 = unit(1, "npc"), default.units = "npc", spreadMethod = c("pad", "reflect", "repeat")) radialGradient(col = c("black", "white"), stops = seq(0, 1, length.out = length(col)), gradientUnits = c("bbox", "coords"), x = unit(0.5, "npc"), y = unit(0.5, "npc"), r = unit(0.5, "npc"), fx = unit(0.5, "npc"), fy = unit(0.5, "npc"), default.units = "npc", spreadMethod = c("pad", "reflect", "repeat")) ```

## Arguments

 `col` A vector of colours used for gradient stops. `stops` A numeric vector of offsets (typically between 0 and 1) to place the the colours (`col`) at. `gradientUnits` If `"bbox"`, the gradient is positioned relative to the bounding box of the referring grob. All units attempt to be converted to equivalent "npc" coordinates as a result. If `"coords"`, uses grid coordinates to determine positioning. `x0` Numeric or unit object indicating the starting x-location of the linear gradient. `x1` Numeric or unit object indicating the stopping x-location of the linear gradient. `y0` Numeric or unit object indicating the starting y-location of the linear gradient. `y1` Numeric or unit object indicating the stopping y-location of the linear gradient. `x` Numeric or unit object indicating the x-location of the radial gradient. `y` Numeric or unit object indicating the y-location of the radial gradient. `r` A numeric vector or unit object specifying the radius of the radial gradient. `fx` A numeric vector or unit object specifying an x-location. Determines the x-location of the focal point of the radial gradient. `fy` A numeric vector or unit object specifying an y-location. Determines the y-location of the focal point of the radial gradient. `default.units` A string indicating the default units to use if `x`, `y`, `r`, `fx` or `fy` are only given as numeric vectors. `spreadMethod` A character vector determining when happens when a gradient begins or ends within its bounds. See details.

## Details

When defining gradient stops via `col` and `stops`, the order is important. Gradient stops which are defined earlier are drawn first, with later stops being drawn over the top.

For `spreadMethod` the possible values are:

• pad Use the terminal colors of the gradient to fill the remainder of the target region.

• reflect Reflect the gradient pattern start-to-end, end-to-start, start-to-end, etc. continuously until the target region is filled.

• repeat Repeat the gradient pattern start-to-end, start-to-end, start-to-end, etc. continuously until the target region is filled.

## Value

A `gradient` object.

## Author(s)

Simon Potter

gridSVG documentation built on April 28, 2020, 9:05 a.m.