[R] Bug? plot.formula does need support plot.first / plot.last param in plot.default
Erez Shomron
r-m@||@ @end|ng |rom erez@h@org
Fri Jul 5 13:35:40 CEST 2024
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
[...]
More information about the R-help
mailing list