Re: [R] help with making a function of scatter plot with multiple variables

2007-09-21 Thread hadley wickham
Tom, It might be easier to move to a higher order plotting model, like ggplot2 or lattice. For a similar plot in ggplot2, all you would do is: qplot(mpg, wt, data=mtcars, col=factor(cyl), shape=factor(cyl)) you would need to do some tweaking to get the plot exactly like you want, but the defaul

Re: [R] help with making a function of scatter plot with multiple variables

2007-09-21 Thread Tom Cohen
Thanks Jim for the excellent solution. Can I make this function more flexible for the usage of different numbers of parameters? Tom jim holtman <[EMAIL PROTECTED]> skrev: The simple way is to enclose it in a 'function' and pass parameters. Assuming that you have the same number of param

Re: [R] help with making a function of scatter plot with multiple variables

2007-09-20 Thread jim holtman
The simple way is to enclose it in a 'function' and pass parameters. Assuming that you have the same number of parameters, then the following will do: my.func <- function(x,y,d1,v1,s1,t1,s2,t2,s3,t3,s4,t4,s5,t5) { op <- par(bg = "grey97") par(mfrow=c(1,2)) plot(d1,v1, pch="v", col="ora