Over the years there have been inquiries to these lists as to how to produce plots with the direction(s) of axes reversed. In response to some of these inquiries, I have provided a function call ``rplot'' which automated the procedure for such axis reversal. Recently Herberto Ghezzo of McGill University pointed out to me that there was a bug in my code. I have now fixed this bug (and a couple of others which I discovered in the revision process). The revised code of rplot() is enclosed below. My thanks to Herberto Ghezzo for spotting the bug and for helping to test the revised version. cheers, Rolf Turner rolf at math.unb.ca ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+==rplot <- function(x, y, xrev = F, yrev = T, xside = if(yrev) 3 else 1, yside = if(xrev) 4 else 2, xlab = NULL, ylab = NULL, bty = NULL, ...) { # # Function rplot --- r for ``reverse'' (to reverse the direction of # axes). # # Copyright (C) 1996 by T. Rolf Turner, University of New Brunswick. # # Permission to use, copy, modify, and distribute this software for # any purpose and without fee is hereby granted, provided that the # above copyright notice and this permission notice appear in all # copies. # # Revised 26/5/99. # # Some bugs fixed 7/2/02, with the assistance of Herberto Ghezzo # of McGill University. # xname <- if(is.null(xlab)) deparse(substitute(x)) else xlab yname <- if(is.null(ylab)) deparse(substitute(y)) else ylab xlab <- if(yrev) "" else xname ylab <- if(xrev) "" else yname y1 <- if(yrev) -y else y x1 <- if(xrev) -x else x old.mar <- par()$mar on.exit(par(mar = old.mar)) par(mar = old.mar[c(xside, yside, 4 - xside, 6 - yside)]) plot(x1, y1, axes = F, xlab = xlab, ylab = ylab, ...) if(xrev) { axis(xside, at = pretty(-x), labels = rev(pretty(x))) mtext(side = yside, line = 2, text = yname) } else axis(xside) if(yrev) { axis(yside, at = pretty( - y), labels = rev(pretty(y)), srt = 90) mtext(side = xside, line = 3, text = xname) } else axis(yside) if(!is.null(bty)) box(bty = bty) invisible() } -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._