r - Why does plot not respect add = TRUE? -
why r's base plot function this? have use points
or lines
, needs special code rather using type
argument.
plot(1:10) plot(10:1, add = true) warning messages: 1: in plot.window(...) : "add" not graphical parameter 2: in plot.xy(xy, type, ...) : "add" not graphical parameter 3: in axis(side = side, @ = at, labels = labels, ...) :
etc.
many packages provide methods (i.e. "override") plot , provide obvious ability plot(obj, add = true) long obj
of appropriate class. (examples sp
, raster
, spatstat
.)
is there reason plot.default
not already?
edit: discussed @ length here:
http://tolstoy.newcastle.edu.au/r/e4/devel/08/03/0725.html
dm answers here: http://tolstoy.newcastle.edu.au/r/e4/devel/08/03/0734.html
because plot.default
doesn't have add
argument
> args(plot.default) function (x, y = null, type = "p", xlim = null, ylim = null, log = "", main = null, sub = null, xlab = null, ylab = null, ann = par("ann"), axes = true, frame.plot = axes, panel.first = null, panel.last = null, asp = na, ...) null
those other functions not overriding plot
providing own methods, have argument add
because written way. personally, having grown using points()
, lines()
etc don't find them work , use them in preference plot
method add
argument, although we've written both ways in packages contribute to.
as why plot.default
doesn't have add
argument? you'd have ask r core, can suggest reasons
plot.default
designed generate entire plot on device- there
points()
,lines()
etc why duplicate? plot.default
simpler code without code handleadd
- backwards compatibility s/s-plus
Comments
Post a Comment