Re: [R] Colour clusters in a 2d plot

2008-07-07 Thread hadley wickham
On Mon, Jul 7, 2008 at 12:51 PM, Josep Maria Campanera Alsina <[EMAIL PROTECTED]> wrote: > R experts, > > I have three columns. c1 and c2 are numeric variables whereas c3 are the > clusters classes (nominal variable, 10 different: cluster1, cluster2, > cluster3, cluster4, cluster5 ). I'd like t

Re: [R] Colour clusters in a 2d plot

2008-07-07 Thread Jorge Ivan Velez
Dear Josep, Does it do the work for you? # Example data set.seed(123) mydata=data.frame(c1=rnorm(100),c2=rnorm(100),cluster=sample(1:10,100,replace=TRUE)) attach(mydata) # Plot plot(c1,c2,col=cluster,pch=16,xlab="Your legend here",ylab="Your legend here") HTH, Jorge On Mon, Jul 7, 2008 at 1:

[R] Colour clusters in a 2d plot

2008-07-07 Thread Josep Maria Campanera Alsina
R experts, I have three columns. c1 and c2 are numeric variables whereas c3 are the clusters classes (nominal variable, 10 different: cluster1, cluster2, cluster3, cluster4, cluster5 ). I'd like to plot c1 against c2 (easy!) in a 2D plot and put different color depending to the cluster class a