R: HSV Color Specification

hsv {grDevices} | R Documentation

## HSV Color Specification

### Description

Create a vector of colors from vectors specifying hue, saturation and value.

### Usage

    hsv(h = 1, s = 1, v = 1, alpha)

### Arguments

`h,s,v` | numeric vectors of values in the range `[0, 1]` for ‘hue’, ‘saturation’ and ‘value’ to be combined to form a vector of colors. Values in shorter arguments are recycled.
`alpha` | numeric vector of values in the range `[0, 1]` for alpha transparency channel (0 means transparent and 1 means opaque).

### Details

Semi-transparent colors (`0 < alpha < 1`) are supported only on some devices: see `rgb`.

### Value

This function creates a vector of colors corresponding to the given values in HSV space. The values returned by `hsv` can be used with a `col=` specification in graphics functions or in `par`.

### See Also

`hcl` for a perceptually based version of `hsv()`, `rgb` and `rgb2hsv` for RGB to HSV conversion; `rainbow`, `gray`.

### Examples

    require(graphics)

    hsv(.5,.5,.5)

    ## Red tones:
    n <- 20;  y <- -sin(3*pi*((1:n)-1/2)/n)
    op <- par(mar=rep(1.5,4))
    plot(y, axes = FALSE, frame.plot = TRUE,
         xlab = "", ylab = "", pch = 21, cex = 30,
         bg = rainbow(n, start=.85, end=.1),
         main = "Red tones")
    par(op)

[Package grDevices version 2.15.1 Index]