[R] Coordinate scales for pairs plot
Greetings all. I suspect this question has already been asked. Apologies for not having taced it ... In the default pairs plot produces by the function pairs(), the coordinate scales alternate between top and bottom and right and left sides. For example, in a 5x5 plot for variables X1, X2, X3, X4, X5 the coordinate scales for X2, X4 appear beside rows 2 and 4 on the left, and the scales for X1, X3, X5 appear beside rows 1, 3, 5 on the right. Similarly, the scales for X2 and X4 appear above columns 2 and 4, and the scales for X1, X3, X5 appear below columns 1, 3, 5. Is there a parameter lurking somewhere in the depths of this function which can be set so that the scales for all the variables X1,X2,X3,X4,X5 appear both above and below columns 1,2,3,4,5; and both to the left and to the right of rows 1,2,3,4,5? With thanks, Ted. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 21-Aug-2013 Time: 18:30:44 This message was sent by XFMail __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Coordinate scales for pairs plot
On Aug 21, 2013, at 10:30 AM, (Ted Harding) wrote: Greetings all. I suspect this question has already been asked. Apologies for not having taced it ... In the default pairs plot produces by the function pairs(), the coordinate scales alternate between top and bottom and right and left sides. For example, in a 5x5 plot for variables X1, X2, X3, X4, X5 the coordinate scales for X2, X4 appear beside rows 2 and 4 on the left, and the scales for X1, X3, X5 appear beside rows 1, 3, 5 on the right. Similarly, the scales for X2 and X4 appear above columns 2 and 4, and the scales for X1, X3, X5 appear below columns 1, 3, 5. Is there a parameter lurking somewhere in the depths of this function which can be set so that the scales for all the variables X1,X2,X3,X4,X5 appear both above and below columns 1,2,3,4,5; and both to the left and to the right of rows 1,2,3,4,5? I've searched for a parameter and come up empty; Hacking the code for pairs.default is not that difficult. I stripped out the conditionals that were driving the Axis calls to alternating sides: Search for `box()` to start this surgery and replace everything to the 'mfg' assignment to get uniform axis locations on sides 1 and 2. pairs.12 - function(x, ... arglist same as pairs.default) {upper portion of code box() if (i == nc ) localAxis(1L , x[, j], x[, i], ...) if (j == 1 ) localAxis(2L, x[, j], x[, i], ...) mfg - par(mfg) lower portion of code } Oooops, that wasn't what you asked for ... Use this instead: box() # begin surgery if (i == 1 ) localAxis(3, x[, j], x[, i], ...) if (i == nc ) localAxis(1, x[, j], x[, i], ...) if (j == 1 ) localAxis(2L, x[, j], x[, i], ...) if (j == nc ) localAxis(4L, x[, j], x[, i], ...) # end anastomosis mfg - par(mfg) .. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Coordinate scales for pairs plot
On 21-Aug-2013 19:08:29 David Winsemius wrote: On Aug 21, 2013, at 10:30 AM, (Ted Harding) wrote: Greetings all. I suspect this question has already been asked. Apologies for not having taced it ... In the default pairs plot produces by the function pairs(), the coordinate scales alternate between top and bottom and right and left sides. For example, in a 5x5 plot for variables X1, X2, X3, X4, X5 the coordinate scales for X2, X4 appear beside rows 2 and 4 on the left, and the scales for X1, X3, X5 appear beside rows 1, 3, 5 on the right. Similarly, the scales for X2 and X4 appear above columns 2 and 4, and the scales for X1, X3, X5 appear below columns 1, 3, 5. Is there a parameter lurking somewhere in the depths of this function which can be set so that the scales for all the variables X1,X2,X3,X4,X5 appear both above and below columns 1,2,3,4,5; and both to the left and to the right of rows 1,2,3,4,5? I've searched for a parameter and come up empty; Hacking the code for pairs.default is not that difficult. I stripped out the conditionals that were driving the Axis calls to alternating sides: Search for `box()` to start this surgery and replace everything to the 'mfg' assignment to get uniform axis locations on sides 1 and 2. pairs.12 - function(x, ... arglist same as pairs.default) {upper portion of code box() if (i == nc ) localAxis(1L , x[, j], x[, i], ...) if (j == 1 ) localAxis(2L, x[, j], x[, i], ...) mfg - par(mfg) lower portion of code } Oooops, that wasn't what you asked for ... Use this instead: box() # begin surgery if (i == 1 ) localAxis(3, x[, j], x[, i], ...) if (i == nc ) localAxis(1, x[, j], x[, i], ...) if (j == 1 ) localAxis(2L, x[, j], x[, i], ...) if (j == nc ) localAxis(4L, x[, j], x[, i], ...) # end anastomosis mfg - par(mfg) .. -- David Winsemius Alameda, CA, USA Thanks very much, David! I'll give it a try. It looks promising. Good surgery, steady hand! Ted. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 21-Aug-2013 Time: 21:23:39 This message was sent by XFMail __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.