In S-PLUS, the ''axis'' function accepts some arguments that don''t exist in the R counterpart. The two that I''m interested in right now are ''pos'' and ''ticks''. Any suggestions on how obtain the same result with R? As a reminder, copy of the S-PLUS help page. USAGE axis(side, at=<<see below>>, labels=T, ticks=T, distn=NULL, line=0, pos=<<see below>>, outer=F) REQUIRED ARGUMENTS side a number representing the side of the plot for the axis (1 for bottom, 2 for left, 3 for top, and 4 for right). OPTIONAL ARGUMENTS at vector of positions at which the ticks and tick labels will be plotted. If side is 1 or 3, at represents x-coordinates. If side is 2 or 4, at represents y-coordinates. If at is omitted, the current axis (as specified by the xaxp or yaxp parameters, see par) will be plotted. labels if labels is logical, it specifies whether or not to plot tick labels. Otherwise, labels must be the same length as at, and label[i] is plotted at coordinate at[i]. ticks if TRUE, tick marks and the axis line will be plotted. distn character string describing the distribution used for transforming the axis labels. The only choice is distn="normal", in which case values of at are assumed to be probability levels, and the labels are actually plotted at qnorm(at). This also implies a reasonable default set of values for the at argument. By default the values in at are used as the labels. line distance from the plot (measured out from the plot in units of standard-sized character heights) at which the axis line will be plotted. Tick labels will be plotted relative to this position using the graphical parameter mgp). pos x- or y-coordinate position at which the axis line should be plotted. Labels will be on the side of the axis specified by side. If pos is omitted, argument line controls positioning of the axis. outer if TRUE, the axis will be drawn in the outer margin rather than the standard plot margin. TIA. Zivan Karaman -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 Thu, May 25, 2000 at 11:15:35AM +0200, zivan.karaman at limagrain.com wrote:> In S-PLUS, the ''axis'' function accepts some arguments that don''t exist in the R > counterpart. > > The two that I''m interested in right now are ''pos'' and ''ticks''. > > Any suggestions on how obtain the same result with R?There is no built-in support at the moment, but it is not too hard to create a function to do the job using abline(), segments() and text() (if it was early in the semester, I''d give it to my class as homework :-). I am poking about in the axis function at the moment and I will add these parameters. Hopefully they will be in the next release. Ross -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 Thu, 25 May 2000 zivan.karaman at limagrain.com wrote:> In S-PLUS, the ''axis'' function accepts some arguments that don''t exist > in the R counterpart. > > The two that I''m interested in right now are ''pos'' and ''ticks''. > > Any suggestions on how obtain the same result with R? >Good news and bad news. The good news: you can pass any graphics parameter to ''axis'', including "tck" (tick length--if set to zero this eliminates ticks) and "mgp" (which is a three-place vector that sets the position of axis title, labels, and lines respectively). The bad news: only the second element of mgp (label position) seems to have any effect (R 1.0.0, RH 6.0). This looks like a couple of bugs ... ## examples par(mfrow=c(2,2)) ## ticks on y-axis but not x-axis plot(c(0,1),c(0,1),axes=FALSE) axis(side=1,tck=0) axis(side=2) ## attempt to move x-title in toward plot, doesn''t work plot(c(0,1),c(0,1),axes=FALSE) axis(side=1,mgp=c(1,1,1),labels=FALSE) axis(side=2,lwd=2) ## move x-labels away from plot plot(c(0,1),c(0,1),axes=FALSE) axis(side=1,mgp=c(1,4,1)) axis(side=2,lwd=2) ## try to move x-axis line, doesn''t work plot(c(0,1),c(0,1),axes=FALSE) axis(side=1,mgp=c(1,1,4)) axis(side=2,lwd=2) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 Thu, 25 May 2000, Ben Bolker wrote:> On Thu, 25 May 2000 zivan.karaman at limagrain.com wrote: > > > In S-PLUS, the ''axis'' function accepts some arguments that don''t exist > > in the R counterpart. > > > > The two that I''m interested in right now are ''pos'' and ''ticks''. > > > > Any suggestions on how obtain the same result with R? > > > > Good news and bad news. > The good news: you can pass any graphics parameter to ''axis'', including > "tck" (tick length--if set to zero this eliminates ticks) and "mgp" (which > is a three-place vector that sets the position of axis title, labels, and > lines respectively). > > The bad news: only the second element of mgp (label position) seems to > have any effect (R 1.0.0, RH 6.0). This looks like a couple of bugs ...pos has nothing to do with mgp: it is the position on the plot in user coordinates. Bill Venables reported it as lacking to R-bugs a little while ago. The problem is that the current R code has hard-coded the axis labels to be in the margins, not in the plot area itself. pos is used to, for example, put an axis in the middle of a plot region. For example plot(c(0,1),c(-0.5,,1),axes=FALSE, xaxs="i") axis(side=1, pos=0) axis(side=2) in S puts an axis at y=0.> ## examples > > par(mfrow=c(2,2)) > ## ticks on y-axis but not x-axis > plot(c(0,1),c(0,1),axes=FALSE) > axis(side=1,tck=0) > axis(side=2)That is not what ticks=F does, either. It omits the axis line too and just plots the labels. plot(c(0,1),c(0,1),axes=FALSE) axis(side=1, ticks=FALSE) gives an axis with 0.0 ... 1.0 and nothing else.> ## attempt to move x-title in toward plot, doesn''t work > plot(c(0,1),c(0,1),axes=FALSE) > axis(side=1,mgp=c(1,1,1),labels=FALSE) > axis(side=2,lwd=2)That''s not a bug. It is plot not axis that puts the x-title on. Try plot(c(0,1),c(0,1),axes=FALSE, mgp=c(1,1,1)) axis(side=1,mgp=c(1,1,1),labels=FALSE)> ## move x-labels away from plot > plot(c(0,1),c(0,1),axes=FALSE) > axis(side=1,mgp=c(1,4,1)) > axis(side=2,lwd=2) > > ## try to move x-axis line, doesn''t work > plot(c(0,1),c(0,1),axes=FALSE) > axis(side=1,mgp=c(1,1,4)) > axis(side=2,lwd=2)True. In S that can also be done by argument line, that moves the axis as a whole (including ticks and labels), and mgp[3] measures the displacement from the line as moved by line=foo. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._