Re: [Rd] Is text(..., adj) upside down? (Or am I?)

2008-07-23 Thread Prof Brian Ripley

On Tue, 22 Jul 2008, Patrick Burns wrote:


Basically the only thing in the thread that was clear
to me was Brian's phrasing.  So I'd suggest basing
any changes on that.


I'll add some words.  There is one other thing which needs explaining, 
what 'bottom' means.  For a character string it means the baseline of the 
text, for an expression the bottom of the text box (plotmath) does not 
attempt to compute baselines.  This also affects the computation of 
vertical centering:


plot(1:5, type="n")
abline(v=2); abline(v=4)
abline(h=1)
text(2,1, "fgh", adj=c(0,0), cex=2)
text(4,1, expression(fgh), adj=c(0,0), cex=2)
abline(h=3)
text(2,3, "fgh", adj=c(0,0.5), cex=2)
text(4,3, expression(fgh), adj=c(0,0.5), cex=2)
abline(h=5)
text(4,5, expression(fgh), adj=c(0,1), cex=2)
text(2,5, "fgh", adj=c(0,1), cex=2)




Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

S Ellison wrote:

Yup; you're all right - it IS consistent (and I'd even checked the x-adj
and it did what I expected!!). It's just that ?text is talking about the
position of the 'anchor' point in the text region rather than the
subsequent location of the centre of the text.

Anyway; if anyone is considering a minor tweak to ?text, would it be
clearer if it said "Values of 0, 0.5, and 1 specify text towards right/top, 
middle and

left/bottom of x,y,  respectively." ?

(or, of course, "Values of 0, 0.5, and 1 specify x,y at left/bottom,
middle and right/top of text, respectively.")

Steve Ellison
Lab of the Government Chemist
UK



***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel





__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Brian D. Ripley,  [EMAIL PROTECTED]
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 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Is text(..., adj) upside down? (Or am I?)

2008-07-22 Thread Patrick Burns

Basically the only thing in the thread that was clear
to me was Brian's phrasing.  So I'd suggest basing
any changes on that.


Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

S Ellison wrote:

Yup; you're all right - it IS consistent (and I'd even checked the x-adj
and it did what I expected!!). It's just that ?text is talking about the
position of the 'anchor' point in the text region rather than the
subsequent location of the centre of the text.

Anyway; if anyone is considering a minor tweak to ?text, would it be
clearer if it said 
"Values of 0, 0.5, and 1 specify text towards right/top, middle and
left/bottom of x,y, 
 respectively." ?


(or, of course, "Values of 0, 0.5, and 1 specify x,y at left/bottom,
middle and right/top of text, respectively.")

Steve Ellison
Lab of the Government Chemist
UK



***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel





__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Is text(..., adj) upside down? (Or am I?)

2008-07-22 Thread S Ellison
Yup; you're all right - it IS consistent (and I'd even checked the x-adj
and it did what I expected!!). It's just that ?text is talking about the
position of the 'anchor' point in the text region rather than the
subsequent location of the centre of the text.

Anyway; if anyone is considering a minor tweak to ?text, would it be
clearer if it said 
"Values of 0, 0.5, and 1 specify text towards right/top, middle and
left/bottom of x,y, 
 respectively." ?

(or, of course, "Values of 0, 0.5, and 1 specify x,y at left/bottom,
middle and right/top of text, respectively.")

Steve Ellison
Lab of the Government Chemist
UK



***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Is text(..., adj) upside down? (Or am I?)

2008-07-22 Thread Prof Brian Ripley

On Tue, 22 Jul 2008, S Ellison wrote:


?text says
   "'adj' allows _adj_ustment of the text with respect to '(x,y)'.
Values of 0, 0.5, and 1 specify left/bottom, middle and
right/top,
respectively."

But it looks like 0, 1 specify top, bottom respectively in the y
direction.

plot(1:4)
text(2,2, "adj=c(0,0)", adj=c(0,0))
text(2,2, "adj=c(0,1)", adj=c(0,1), col=2) #the red one's below the
black one...


If that comment is what you see (and I do on X11), it is as documented. In 
the first text() call the left bottom of the text box is at the specified 
point. In the second text() call the left top of the text box is at the 
specified point, so the text box should be lower.



#x-adj is OK
text(3,3, "adj=c(0,0)", adj=c(0,0))
text(3,3, "adj=c(1,0)", adj=c(1,0), col=2)

[I am using r 2.7.1 in windows; adj behaviour is consistent in 2.6.0ff
and for expressions as well as text]


All 'vertical' adjustment is done in the graphics engine: some 
'horizontal' adjustment is done in the devices.



Perhaps a two-word correction to ?text ?


'adjustment' is not well-defined for text position, whereas 'alignment' or 
'justification' are, so I suggest adding one of those before 
'respectively'.




Steve Ellison
Lab of the Government Chemist
UK

***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Brian D. Ripley,  [EMAIL PROTECTED]
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 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Is text(..., adj) upside down? (Or am I?)

2008-07-22 Thread Peter Dalgaard

S Ellison wrote:

?text says
"'adj' allows _adj_ustment of the text with respect to '(x,y)'.
 Values of 0, 0.5, and 1 specify left/bottom, middle and
right/top,
 respectively."

But it looks like 0, 1 specify top, bottom respectively in the y
direction.

plot(1:4)
text(2,2, "adj=c(0,0)", adj=c(0,0))
text(2,2, "adj=c(0,1)", adj=c(0,1), col=2) #the red one's below the
black one...

#x-adj is OK
text(3,3, "adj=c(0,0)", adj=c(0,0))
text(3,3, "adj=c(1,0)", adj=c(1,0), col=2)

[I am using r 2.7.1 in windows; adj behaviour is consistent in 2.6.0ff
and for expressions as well as text]

Perhaps a two-word correction to ?text ?
  

You're just confused:

TOP adjusted text is BELOW bottom-adjusted text.
RIGHT adjusted text to the LEFT of left-adjusted text.

See?

--
  O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
 c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Is text(..., adj) upside down? (Or am I?)

2008-07-22 Thread Duncan Murdoch

On 7/22/2008 7:36 AM, S Ellison wrote:

?text says
"'adj' allows _adj_ustment of the text with respect to '(x,y)'.
 Values of 0, 0.5, and 1 specify left/bottom, middle and
right/top,
 respectively."

But it looks like 0, 1 specify top, bottom respectively in the y
direction.

plot(1:4)
text(2,2, "adj=c(0,0)", adj=c(0,0))
text(2,2, "adj=c(0,1)", adj=c(0,1), col=2) #the red one's below the
black one...

#x-adj is OK
text(3,3, "adj=c(0,0)", adj=c(0,0))
text(3,3, "adj=c(1,0)", adj=c(1,0), col=2)

[I am using r 2.7.1 in windows; adj behaviour is consistent in 2.6.0ff
and for expressions as well as text]

Perhaps a two-word correction to ?text ?


I think it is behaving as I'd expect:  the y adjustment of 0 says that 
the bottom of the text aligns with the specified point, while the y 
adjustment of 1 says that the top of the text aligns there.  This is 
consistent with the description for x:  0 says the left end aligns, 1 
says the right end aligns.


The text may be a little terse, but it is consistent.

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Is text(..., adj) upside down? (Or am I?)

2008-07-22 Thread S Ellison
?text says
"'adj' allows _adj_ustment of the text with respect to '(x,y)'.
 Values of 0, 0.5, and 1 specify left/bottom, middle and
right/top,
 respectively."

But it looks like 0, 1 specify top, bottom respectively in the y
direction.

plot(1:4)
text(2,2, "adj=c(0,0)", adj=c(0,0))
text(2,2, "adj=c(0,1)", adj=c(0,1), col=2) #the red one's below the
black one...

#x-adj is OK
text(3,3, "adj=c(0,0)", adj=c(0,0))
text(3,3, "adj=c(1,0)", adj=c(1,0), col=2)

[I am using r 2.7.1 in windows; adj behaviour is consistent in 2.6.0ff
and for expressions as well as text]

Perhaps a two-word correction to ?text ?

Steve Ellison
Lab of the Government Chemist
UK

***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel