On Thu, 2010-08-26 at 06:11 +0800, elaine kuo wrote: > Thank you. > The answers provides the right direction and a code was written accordingly. > > One more request, if the label of axis X wants to be drawn from 5 to 1 (left > to right) > rather than 1 to 5, is it fine to change axis (4, at = NULL) ? > If so, which value should be input ?
If I understand you correctly, No. The data have been plotted assuming xlim of (more or less) c(1, 5). All axis can do is change the labels and where the marks are placed. You need to manually set the xlim argument to plot to get the data plotted the other way round. plot(1:5, axes = FALSE, xlim = c(5,1)) axis(1) axis(4) box() Notice that all we've done here is change the limits for the x axis in the plot() call, we haven't had to change any of the other code. Note also that axis(side = 4) is on the one on the right so doesn't pertain to the x-axis. If you want to know how to use axis more flexibly, read ?axis as it explains there what 'at' is a requires as input from you. For example, we might want to label at different points, not 1,2,3,4,5 etc: plot(1:5, axes = FALSE, xlim = c(5,1)) axis(1) axis(4, at = seq(1.5, 4.5, by = 1)) box() HTH G > > Thanks again. > > Elaine > > code > plot(1:5,axes=FALSE) > axis(1) > axis(4) > box() > > > > > On Wed, Aug 25, 2010 at 5:39 PM, Jim Lemon <j...@bitwrit.com.au> wrote: > > > On 08/25/2010 09:12 AM, elaine kuo wrote: > > > >> Dear List, > >> > >> I have a richness data distributing across 20 N to 20 S latitude. (120 > >> E-140 > >> E longitude). > >> > >> > >> I would like to draw the richness in the north hemisphere and a regression > >> line in the plot > >> (x-axis: latitude, y-axis: richness in the north hemisphere). > >> The above demand is done using plot. > >> > >> Then, south hemisphere richness and regression are required to be > >> generated > >> using > >> the same y-axis above but an x-axis on the left side of the y-axis. > >> (The higher latitude in the south hemisphere, the left it would move) > >> > >> Please kindly share how to design the south plot and regression line for > >> richness. > >> Also, please advise if any more info is in need. > >> > >> Hi Elaine, > > Changing the position of the axes is easily done by changing the "side" and > > "pos" arguments of the "axis" function. If you want to move the y-axis to > > the right (or as you state it, the x axis to the left): > > > > # y axis on the left > > plot(1:5,axes=FALSE) > > axis(1) > > axis(2) > > # add a y axis one third of the way to the right > > xylim<-par("usr") > > axis(2,pos=xylim[1]+diff(xylim[1:2])/3) > > # add another y axis two thirds of the way > > axis(4,pos=xylim[2]-diff(xylim[1:2])/3) > > # add one more on the right > > axis(4) > > > > You can move the x axis up and down using the same tricks. > > > > Jim > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ 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.