Re: [R] ggplot2 argument handling odd

2008-03-31 Thread Sebastian Weber
Hi Hadley, I tried today your solution to this problem. However, the finally working code was like eval(substitute(ggplot( aes_string(...) )) The qplot code below did not work at all, neither works a ggplot(aes_string(...)) BTW: Since I am always writing scripts to produce my plots, how can I

Re: [R] ggplot2 argument handling odd

2008-03-27 Thread hadley wickham
> Ok, I will try that, thanks. BTW, where is this aes_string option > documented, sounds useful? How could I do the same thing with facetting? > If I want to save something like ". ~ groupVar" as a string in a > variable, could I pass it with facet_string to ggplot? It's a see also from ?aes (

Re: [R] ggplot2 argument handling odd

2008-03-27 Thread Sebastian Weber
Hi! > In this case you are better off moving away from qplot (which does > various substitute tricks to assemble the named variables in a data > frame) to a more explicit form of ggplot: > > pl2[[obs]] <- ggplot(cData, aes_string(x="x3", y=obs)) + geom_point() > + opts(title = obs) Ok, I will tr

Re: [R] ggplot2 argument handling odd

2008-03-26 Thread hadley wickham
On Wed, Mar 26, 2008 at 11:03 AM, Sebastian Weber <[EMAIL PROTECTED]> wrote: > Hello there, > > I'm trying to do lots of plots in one for-loop. But somehow ggplot does > not evaluate arguments as expected. Here is an example: > > library(lattice) > library(ggplot2) > pl <- list() > pl2 <- lis

[R] ggplot2 argument handling odd

2008-03-26 Thread Sebastian Weber
Hello there, I'm trying to do lots of plots in one for-loop. But somehow ggplot does not evaluate arguments as expected. Here is an example: library(lattice) library(ggplot2) pl <- list() pl2 <- list() cDat <- as.data.frame(cbind(x1=0:100,x2=0:10,x3=1:20)) for(obs in c("x1", "x2")) { pl[[obs]]