[R] changing coordinates?

Ott Toomet siim at obs.ee
Tue Oct 29 08:09:41 CET 2002

On Mon, 28 Oct 2002, Richard Mueller wrote:

  |I just detected R and have, after browsing the manual, one question:
  |I look for quite a lot of time for graphical software which allows to 
  |plot data from a table or external file _with the axes of the coordinate 
  |system changed_, i.e. the x-axis should run from top left to bottom 
  |left, and the y-axis from top-left to top-right. It is of no use to 
  |interchange the rows in the table, the coordinate system should rely of 
  |that definition. This type of plot is used in limnological and 
  |oceanological graphs. Until now I could find no software which can do 
  |that job. Perhaps one of you can answer this beginner's question with a 
  |simple yes or no?
  |Thank you, Richard

Short answer is yes, you can do it.

There is no pre-programmed plot command in order to do that, however.  You
have to transform you data a bit, e.g. changing the sign.  Suppose you have

> x <- c(1,2,3,-1)
> y <- 1:4

In that case you can do something like

> plot(y, -x, yaxt="n", xaxt="n")
> axis(2, at=pretty(-x), labels=as.character(-pretty(-x)))
> axis(3)

Perhaps you get an idea.


Ott Toomet
otoomet at econ.au.dk


 (o_         (*_         (O_         (o< -!      (o<)<
//\         //\         //\         //\         //\
V_/_        V_/_        V_/_        V_/_        V_/_

standard    drunken     shocked     noisy      penguin
penguin     penguin     penguin     penguin    eating fish

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

More information about the R-help mailing list