john.maindonald@anu.edu.au
2000-Jan-10 01:40 UTC
'at' parameter in mtext(.., adj=0, outer=T) (PR#396)
Depending on the setting of par()$usr,
the 'at' setting in mtext(.., adj=0, outer=T) may cause the
text to appear in an anomalous position (e. g. in the first
instance below, at the left of the plot region rather than
at 'at=0' in the figure region), or the text may not appear
at all.
If one does not set the 'at' parameter the text appears
(with 'adj=0') on the far left of the plot region. I assume
this is also anomalous; at all events it is the behaviour
that I wished to circumvent.
The function plot.test() demonstrates the behaviour:
plot.test <-
function(xval=0:4, pos=NULL){
oldpar<-par(oma=c(2,0,0,0))
on.exit(par(oldpar))
plot(xval,xval)
if(is.null(pos))pos<-min(xval)
print(pos)
print(par()$usr)
mtext(side=1,line=3.5,"Marginal text",adj=0,at=pos)
mtext(side=1,line=0.5,"Outer text",outer=T, adj=0,at=min(xval))
}
> plot.test(xval=0:4) # "Outer text appears on left of the figure
region
[1] 0
[1] -0.16 4.16 -0.16 4.16> plot.test(xval=20:24) # "Outer text does not appear at all
[1] 20
[1] 19.84 24.16 19.84 24.16> # Check that at=0 does not work
> plot.test(xval=20:24, pos=0) # "Outer text does not appear at all
[1] 0
[1] 19.84 24.16 19.84 24.16>
--please do not edit the information below--
Version:
platform = Windows
arch = x86
os = Win32
system = x86, Win32
status =
major = 0
minor = 90.1
year = 1999
month = December
day = 15
language = R
Windows 9x 4.0 (build 1111) B
Search Path:
.GlobalEnv, Autoloads, package:base
John Maindonald email : john.maindonald@anu.edu.au
Statistical Consulting Unit, phone : (6249)3998
c/o CMA, SMS, fax : (6249)5549
John Dedman Mathematical Sciences Building
Australian National University
Canberra ACT 0200
Australia
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian D Ripley
2000-Jan-15 18:46 UTC
'at' parameter in mtext(.., adj=0, outer=T) (PR#396)
On Mon, 10 Jan 2000 john.maindonald@anu.edu.au wrote:> Depending on the setting of par()$usr, > the 'at' setting in mtext(.., adj=0, outer=T) may cause the > text to appear in an anomalous position (e. g. in the first > instance below, at the left of the plot region rather than > at 'at=0' in the figure region), or the text may not appear > at all. > > If one does not set the 'at' parameter the text appears > (with 'adj=0') on the far left of the plot region. I assume > this is also anomalous; at all events it is the behaviour > that I wished to circumvent.I am afraid this is documentation confusion. There are no user coordinates in the outer margins, and at works like adj if outer=TRUE. Indeed the example mtext(side=1,line=0.5,"Outer text",outer=T, adj=0) does work correctly for me: specifying adj=0 means put it at the extreme left, adj=1 at the extreme right, and adj=0 to centre it (on the display region, not the figure region). I will re-write the documentation.> > The function plot.test() demonstrates the behaviour: > > plot.test <- > function(xval=0:4, pos=NULL){ > oldpar<-par(oma=c(2,0,0,0)) > on.exit(par(oldpar)) > plot(xval,xval) > if(is.null(pos))pos<-min(xval) > print(pos) > print(par()$usr) > mtext(side=1,line=3.5,"Marginal text",adj=0,at=pos) > mtext(side=1,line=0.5,"Outer text",outer=T, adj=0,at=min(xval)) > } > > > plot.test(xval=0:4) # "Outer text appears on left of the figure region > [1] 0 > [1] -0.16 4.16 -0.16 4.16 > > plot.test(xval=20:24) # "Outer text does not appear at all > [1] 20 > [1] 19.84 24.16 19.84 24.16 > > # Check that at=0 does not work > > plot.test(xval=20:24, pos=0) # "Outer text does not appear at all > [1] 0 > [1] 19.84 24.16 19.84 24.16 > > > > > --please do not edit the information below-- > > Version: > platform = Windows > arch = x86 > os = Win32 > system = x86, Win32 > status = > major = 0 > minor = 90.1 > year = 1999 > month = December > day = 15 > language = R > > Windows 9x 4.0 (build 1111) B > > Search Path: > .GlobalEnv, Autoloads, package:base > > John Maindonald email : john.maindonald@anu.edu.au > Statistical Consulting Unit, phone : (6249)3998 > c/o CMA, SMS, fax : (6249)5549 > John Dedman Mathematical Sciences Building > Australian National University > Canberra ACT 0200 > Australia > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-devel 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-devel-request@stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- Brian D. Ripley, ripley@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-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._