Why does R's base plot function do this? We have to use points
or lines
, which needs special code rather than using the type
argument.
plot(1:10)
plot(10:1, add = TRUE)
Warning messages:
1: In plot.window(...) : "add" is not a graphical parameter
2: In plot.xy(xy, type, ...) : "add" is not a graphical parameter
3: In axis(side = side, at = at, labels = labels, ...) :
Etc.
Many packages provide methods for (i.e. "override") plot and provide the obvious ability to plot(obj, add = TRUE) as long as obj
is of the appropriate class. (Examples are sp
, raster
, spatstat
.)
Is there any reason plot.default
does not already?
EDIT: this was discussed at length here:
https://stat.ethz.ch/pipermail/r-devel/2008-March/048628.html
DM effectively answers it here:
https://stat.ethz.ch/pipermail/r-devel/2008-March/048650.html
See Question&Answers more detail:os