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 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, Oct 28, 2002 at 10:24:30PM +0100, 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?R is more statistical package than graphical one -- if you need sophisticated graphs then you are probably much better with gnuplot (http://www.cs.dartmouth.edu/gnuplot_info.html), which is similar to R in being highly sophisticated (and ported on many different architectures -- there are well supported ports to both Linux and M$-Windows), but it is a pure graphing package. Matej -- Matej Cepl, matej at ceplovi.cz, PGP ID# D96484AC 138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488 The main idea of the pope's asking for forgivness was not to be afraid of the truth. DO NOT BE AFRAID OF TRUTH! We have to have faith in the God's governing power to be able not to be afraid. -- On NPR The Connection from March 13, 2000 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 data> x <- c(1,2,3,-1) > y <- 1:4In 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 -- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi Richard It doesn't matter whether you use rows for the x or the y axis. The plot commands take sets of data points. Pass plot two vectors for x and y and you get your plot. So if, for example, depth is your "x-axis", but you want it where the "y-axis" is and you want to plot some data against it (oxygen profile) then: plot(x = o2, y = depth) #where o2 and depth are rows or columns of a data frame, matrix, or two vectors. Now, I'm a (palaeo)limnologist and we often want y-axis to start from 0 at the top left like you do. The beauty of R (over some of the other stratigraphic plotting tools I have had the misfortune to use over the years) is that you can very simply tell plot() what the axis should be ranged like: o2 <- c(1, 5, 6, 8, 10, 2, 3, 4, 8, 9, 15, 10, 4, 7, 3) # made-up o2 profile (random typing ;-) ) depth <- c(0:14) # depth in m from 0m to 14m plot(x = o2, y = depth, ylim = c(14, 0) + 0.1, type="b", main="O2 profile for Foo Lake") If you want to pop the "x-axis" (o2) labels along the top rather than the default (bottom) then something like this will work: oldpar <- par(mar = c(3, 4, 5, 2) + 0.1) # give a larger top and smaller bottom margins plot(x = o2, y = depth, ylim = c(14, 0) + 0.1, type="b", main="O2 profile for Foo Lake", axes = FALSE) #don't plot the axes axis(side = 2) # plot the left axis axis(side = 3) # plot the top axis box() # finish off with a box round the plot par(oldpar) # reset margins So as you can see R's graphics are very flexible and can be made to do what you want (mostly!). And that's without getting into lattice() graphics. I suggest that you have a look at the Introduction to R manual from CRAN (under documentation) and read the plotting section for an overview of what is possible. Or see one of the Contributed texts (e.g. Maindonald's "Using R for Data Analysis and Graphics"). Almost every graphics or plotting requirement I have had to do with my PhD data I have been able to do it in R. The only thing I couldn't do was plot vertical dendrograms to finish off an image() plot with separate dendrograms along the top and the left of the plotting area, but this has now been added to the functionality of R (from 1.6.0). Gav %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. & ECRC [E] gavin.simpson at ucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -----Original Message----- From: owner-r-help at stat.math.ethz.ch [mailto:owner-r-help at stat.math.ethz.ch] On Behalf Of Richard Mueller Sent: 28 October 2002 21:25 To: r-help at stat.math.ethz.ch Subject: [R] changing coordinates? 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 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._._._ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._