[R] colour coding and different point types in a plot

Grum, Mikkel M.GRUM at CGIAR.ORG
Tue Jan 8 15:00:11 CET 2002


I'm trying to plot four different sorghum types on a plot using a different
colour/symbol combination for each sorghum type (TYPBOTA in the script
below).  What am I doing wrong?:

plot(xx$LATITUDE,xx$SFD1,
   points(xx$SFD1,xx$LATITUDE,
   col=1:4[codes(xx$TYPBOTA)],pch=c(4,3,1,2)[codes(xx$TYPBOTA)])
grid()

I get the following error message
Error in 1:4[codes(xx$TYPBOTA)] : NA/NaN argument
In addition: Warning message: 
Numerical expression has 162 elements: only the first used in:
1:4[codes(xx78$TYPBOTA)] 


Best wishes,
Mikkel


Mikkel Grum, PhD
Genetic Diversity Scientist
International Plant Genetic Resources Institute (IPGRI)
Sub-Saharan Africa Group
***
c/o ICRAF
PO Box 30677 Nairobi, Kenya
Tel: 254 2 524505 / 524500
Fax: 254 2 524501 / 524001
IVDN Tel: 645 4505 / 4500
IVDN Fax: 645 4501 / 4001
m.grum at cgiar.org
ipgri-kenya at cgiar.org
www.ipgri.cgiar.org

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list