[R] "panel.first" passed to plot() in "..."

Yihui Xie xieyihui at gmail.com
Thu Sep 3 07:16:48 CEST 2009


Hi everyone,

The code below will only draw grid lines in the *first* plot because
'panel.first' has already been evaluated (and hence it's NULL) after
the first plot is drawn:

devAskNewPage(TRUE)
f = function(...) {
    for (i in 1:5) plot(rnorm(10), ...)
}
f(panel.first = grid())

For i in 2:5, panel.first = NULL will not produce the grid. I didn't
understand it until I saw Prof Ripley's reply in the trashcan of the
bug list 9 years ago
(http://bugs.r-project.org/cgi-bin/R/trashcan?id=458;expression=panel.first;user=guest).
I wonder in my example, how can I get the grid drawn in each plot with
"panel.first" in "..."? Thanks a lot!

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA




More information about the R-help mailing list