Hi,

I have a table with three columns of data, let's call these a, b and c. I have produced a scatter plot of a against b, but I would like to colour the points according to their corresponding c values. c takes the value of either 0,1,2,3 or 4 and so I would like to colour all of the points with a c value of 0 one colour, all those with a c value of 1 another colour etc. When I use the following code, it colours the points using default colours, which are not suitable:

data<-read.table('abc',header=T, sep="\t")
attach(data)
library(lattice)
xyplot(a~b, col=c)

I was therefore wondering how to specify my own set of colours for each of the c values. Any help would really be appreciated as I have spent ages reading through the documentation, but with no luck.

Thanks,

Sarah

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to