[R] plot with diffrent colour and plotting symbols

John Kane jrkrideau at yahoo.ca
Wed Mar 19 19:41:01 CET 2008


?points

Does this do what you wanted?
-------------------------------------------------
plot(tt, var2,xaxt ="n", ylim=c(min(Var[1:3]),
max(Var[1:3])))
axis(1,1:length(unique(var1)), labelname)

points(tt, var3, col="green")
points(tt,var4, col= "red")
---------------------------------------------------

--- Diego Culattoni <diegoculattoni at yahoo.com> wrote:

> Dear mailing list members,
> 
> I am a new R user, I would like to plot the
> follewing data
> 
> var1 <- c(1,2,1,1,2,1,2,1,2,2)
> var2 <- round(rgamma(10,2,1)/0.1)*0.1
> var3 <- c(0,1,0,1,0,0,0,0,1,0)
> var4 <- c(1,2,2,2,1,1,1,1,1,1)
> 
> Var <- data.frame(var1,var2,var3,var4)
> Var <- Var[sort(Var$var1),]
> tt <- Var$var1+((runif(length(Var$var1))/6)-(0.5/6))
> labelname <- c("time 1", "time 2")
> 
> plot(tt,var2,xaxt = "n")
> axis(1,1:length(unique(var1)), labelname)
> 
> Could you tell me please how can I get diffrent
> colour and plotting symbols according to var3 and
> var4, respectively.
> 
> Diego!
> 
> 
>      
>
____________________________________________________________________________________
> Looking for last minute shopping deals?  
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.
> 



[[elided trailing spam]]



More information about the R-help mailing list