For points the symbols can be changed using the pch argument. The following example shows a simple plot with a colored square symbol for the points.
x <- c(1,2,3,4,5,6)
y <- c(3,6,9,4,3,4)
plot(x, y, pch=22, type=’b‘, ylim=c(1,10), col=’blue‘, bg=’red‘)
In the previous example we have used the value 22 for the pch argument. But of course there are some other symbols. You may use values between 0 and 25. The following code creates all the available symbols.
x <- c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7)
y <- c(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2)
plot(x, y, pch=0:25, axes=F, xlab=“, ylab=“, ylim=c(5,0), col=’blue‘, bg=’red‘)
text(x, y, pos=3, offset=0.7, labels=0:25)
Beside the symbols you can also use any single character for a point. Furthermore it is possible to define different symbols or characters for each point by passing a vector to the pch value. The following example shows a plot with different characters for each point.
x <- c(1,2,3,4,5,6)
y <- c(3,6,9,4,3,4)
points <- c(‚A‘,’1′,’@‘,’¦‘,’§‘,’*‘)
plot(x, y, pch=points, type=’b‘, ylim=c(1,10))