Bugzilla – Bug 14919

Allow pairs to support log axes

Last modified: 2012-06-26 11:30:45 UTC

Consider data that is exponentially distributed: x <- data.frame(a=rexp(10, 0.01)) x$b <- x$a * rexp(10, 0.02) x$c <- x$b * rexp(10, 0.03) pairs(x) Ideally I'd like to plot these data pairs with log x and y axes. Here is my partial failed attempt with R version 2.15.0 (2012-03-30): > pairs(x, log="xy") There were 12 warnings (use warnings() to see them) > warnings() Warning messages: 1: In axis(side = side, at = at, labels = labels, ...) : "log" is not a graphical parameter 2: In plot.xy(xy.coords(x, y), type = type, ...) : "log" is not a graphical parameter 3: In axis(side = side, at = at, labels = labels, ...) : "log" is not a graphical parameter 4: In plot.xy(xy.coords(x, y), type = type, ...) : "log" is not a graphical parameter 5: In axis(side = side, at = at, labels = labels, ...) : "log" is not a graphical parameter 6: In plot.xy(xy.coords(x, y), type = type, ...) : "log" is not a graphical parameter 7: In plot.xy(xy.coords(x, y), type = type, ...) : "log" is not a graphical parameter 8: In axis(side = side, at = at, labels = labels, ...) : "log" is not a graphical parameter 9: In plot.xy(xy.coords(x, y), type = type, ...) : "log" is not a graphical parameter 10: In plot.xy(xy.coords(x, y), type = type, ...) : "log" is not a graphical parameter 11: In axis(side = side, at = at, labels = labels, ...) : "log" is not a graphical parameter 12: In axis(side = side, at = at, labels = labels, ...) : "log" is not a graphical parameter The result has 12 warnings and the diagonal labels are missing. However, the log axes and scatter points appear to be correct.

Created attachment 1298 [details] pairs accepting log='' argument I find this request useful and implemented myself. Tested with all examples in example(pairs) and with snippet provided at the first comment. Hope this is useful to someone.

There are several problems with this patch, the main one being that it assumes that 'log' requests log scale on both axes whereas log="" and log = "y" are both valid values. It is much simpler to follow plot.default() and have an explicit 'log' argument. Somethings along those lines will appear in R-devel.