Try this:
library('ggplot2')
variables=c("drat","qsec")
for (yVar in variables) {
print(ggplot(mtcars, aes_string(x = 'wt', y= yVar)) +
geom_point() +
opts(title=yVar)
)
}
aes_string() is used to pass a character string as values of the x and
y arguments. For the main title, the value of the title argument is a
character string, so you're covered there.
HTH,
Dennis
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2