R-alpha: R 0.50.a3: title( .. adj= x) AND mtext( .. adj= x)

Peter Dalgaard BSA p.dalgaard@kubism.ku.dk
13 Aug 1997 00:39:14 +0200


Martin Maechler <maechler@stat.math.ethz.ch> writes:

> For  'mtext(..)'  adj does something but not the proper one :
> 
> 	plot(1:10)#-- or just in the plot above..
> 
> 	mtext( "This is an 'mtext(.. adj=0)'", adj = 0)
> 	mtext( "This is an 'mtext(.. adj=1)'", adj = 1)
> 	## is different but result is WRONG: adj=1 is LEFT of adj=0

-- as it should be! adj=0 is left-aligned, adj=1 is right-aligned

(take a string, attach a scale 0 to 1 along it, mark the value of adj
on scale, attach that point to the anchor point, i.e. the midpoint of
the plotting frame).

> 
> 
> for  'text(..)'   adj works as it should, at least in the cases I used it.
> 					 [ -> see the example in  ?text]

seems to work exactly the same!

The confusion seems to come from wanting 0/0.5/1 to mean
left/center/right-*justified* along the plot frame, which it really
doesn't. 

Even if it did, it wouldn't help, the control really needs to be
two-dimensional: you might want text left/center/right aligned with
the top of the y-axis. The at= parameter *almost* does it, but it is
in user coordinates, rather than frame coordinates. Perhaps we want an
anchor= parameter? -- or even better, a way of attaching units to plot
lengths. This kind of problem also appears with text() and legend()
(ever tried to produce plots with different scales but the legends in
the exact same spot?).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-