Dear list,
   
  I have done a scatter plot of  multiple variables in the same graph, with different col and pch. I managed to do it with the following code but not know how to make a function of these so that next time if I want to do similar graph but with new variables, I dont have to copy the code and then change the old variables with the new ones but just call a function with the new variables. I dont have any experience in making a function and would be very grateful if you can help me. A function will shorten my prog dramatically, since I repeat tthis type of graph alots in my analysis.
   
  Thanks in advance,
  Tom
   
  op <- par(bg = "grey97")
par(mfrow=c(1,2))
plot(d1,v1, pch="v", col="orange",cex=0.6, lwd=2,
    xlab="day", ylab="resp",cex.main =1,font.main= 1,main=" Surv data",ylim=y,xlim=x,
    col.main="navyblue",col.lab="navyblue",cex.lab=0.7)
                
    points(s1,t1, pch="A", col="green4", cex=1)
    points(s2,t2, pch="B",col="navyblue", cex=1)
    points(s3,t3, pch="C",col="red", cex=1)
    points(s4,t4, pch="D",col="darkviolet", cex=1)
    points(s5,t5, pch="E",col="blue", cex=1)
      legend("topright",lbels,col=c("orange","green4","navyblue","red","darkviolet","blue"),
     text.col=c("orange","green4","navyblue","red","darkviolet","steelblue"),
     pch=c("v","A","B","C","D","E"),bg='gray100',cex=0.7,box.lty=1,box.lwd=1)
    abline(h = -1:9, v = 0:8, col = "lightgray", lty=3)         
par(op)
  
  

       
---------------------------------

Jämför pris på flygbiljetter och hotellrum: http://shopping.yahoo.se/c-169901-resor-biljetter.html
	[[alternative HTML version deleted]]

