Is the following a bug in your opinion? I think so.

This works as expected:

```
with(mtcars, plot(wt, mpg, plot.first = {
    plot.window(range(wt), range(mpg))
    arrows(3, 15, 4, 30)
}))
```

This does not.

```
plot(mpg ~ wt, data = mtcars, plot.first = {
    plot.window(range(wt), range(mpg))
    arrows(3, 15, 4, 30)
})
```

With error:
```
Error in arrows(3, 15, 4, 30) : plot.new has not been called yet
```

The second example should work.

>From the docs:

?plot.formula
"     For the ‘plot’ method the formula can be of the form ‘~ z + y +
     z’: the variables specified on the right-hand side are collected
     into a data frame, subsetted if specified, and displayed by
     ‘plot.data.frame’.
"

?plot.data.frame
"     ...: further arguments to ‘stripchart’, ‘plot.default’ or ‘pairs’.
"

And plot.default has both plot.first and plot.last

It seems very arbitrary you can't use these parameters with the plot.formula 
method specifically.

> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-suse-linux-gnu
Running under: openSUSE Tumbleweed
[...]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to