## The colours of the Rainbow

There are several ways to specify colours in R.

```plot(1:10, col="red") # red - obviously
plot(1:10, col=2)     # red - 2nd colour of the default palette
plot(1:10, col="#ff0000") # red - hexadecimal
```

The list of the 657 colours that R knows by name can be found with the the function colour( ) or color( ), and begins

[1] “white” “aliceblue” “antiquewhite” “antiquewhite1” “antiquewhite2” “antiquewhite3” “antiquewhite4” “aquamarine” “aquamarine1” “aquamarine2” “aquamarine3” “aquamarine4” “azure” “azure1” “azure2” “azure3” “azure4” “beige” “bisque” “bisque1” “bisque2” “bisque3” “bisque4” “black” “blanchedalmond” “blue” “blue1” ….

But what sort of colour is bisque, and how does antiquewhite differ from beige?

Here is code for a colour chart that can you help pick the colour you want

```cols<-colours()
x11();par(mar=rep(0,4))#no margins
grd<-expand.grid(1:26,1:26)[1:length(cols),]
plot(grd, col=cols, pch=16, axes=FALSE, cex=2)
cols[identify(grd, labels=cols, cex=.7)]
```

Click on a colour you like, and its name will appear on the plot. When you have enough colours, click stop, and R will give you the names you clicked on.

If you want a sequence of colours, rather than just a single colour, there are the built-in colour sequences like rainbow( ) and heat.colours( ), or you can make your own colour sequences with colorRampPalette( ).

```x11()
# ten colours from part of a rainbow
plot(1:10, col=rainbow(n=10, start=0, end=4/6), pch=16)

#thirty colours from a sequences from red to blue via white
plot(1:30,col=colorRampPalette(c("red","white","blue"))(n=30))
```