Bug 14919 - Allow pairs to support log axes
Allow pairs to support log axes
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Wishlist
R 2.15.0
All All
: P5 enhancement
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-15 00:51 UTC by Mike Toews
Modified: 2012-06-26 11:30 UTC (History)
1 user (show)

See Also:


Attachments
pairs accepting log='' argument (2.04 KB, patch)
2012-05-25 03:18 UTC, David Valentim Dias
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Toews 2012-05-15 00:51:53 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.
Comment 1 David Valentim Dias 2012-05-25 03:18:26 UTC
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.
Comment 2 Brian Ripley 2012-06-26 11:30:45 UTC
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.