From ripley at stats.ox.ac.uk  Thu Aug  7 07:13:50 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 7 Aug 2008 06:13:50 +0100 (BST)
Subject: [Rd] axis() ignores supplied value of argument mgp[3]?
In-Reply-To: <g7dfgi$f22$1@ger.gmane.org>
References: <g5tihu$k8u$1@ger.gmane.org>
	<alpine.LFD.1.10.0807291612130.30827@gannet.stats.ox.ac.uk>
	<g75qu2$u9h$1@ger.gmane.org>
	<alpine.LFD.1.10.0808041006480.11319@gannet.stats.ox.ac.uk>
	<g7dfgi$f22$1@ger.gmane.org>
Message-ID: <alpine.LFD.1.10.0808070613150.3607@gannet.stats.ox.ac.uk>

Have you looked at the current documentation on the svn server?

On Wed, 6 Aug 2008, J. R. M. Hosking wrote:

> Prof Brian Ripley wrote:
>> On Sun, 3 Aug 2008, J. R. M. Hosking wrote:
>> 
>>> Prof Brian Ripley wrote:
>>>> What is true is that the line is set before the inline setting of mgp is 
>>>> processed: it all depends on what 'supplied' means, and you supplied two 
>>>> values.
>>>> 
>>>> This is changed in R-patched now.
>>> 
>>> Thank you, that works.  Here is a perhaps related issue:
>>> 
>>> R Help on 'axis' for argument 'line' says "The relative placing of
>>> tick marks and tick labels is unchanged".  But this appears not to be
>>> the case when graphics parameter mgp[3] is nonzero:
>>>
>>>  plot(1:4, yaxt="n")
>>>  par(mgp=c(3,2,1))
>>>  axis(2, 1:2)
>>>  axis(2, 3:4, line=1)
>>> 
>>> which one (or, at least, I) would expect to place all the tick labels
>>> the same distance into the margin, does not in fact do so.
>> 
>> I don't think that is what it says. Setting 'line' or 'pos' temporarily 
>> sets mgp[3] to zero (which is what the help implies in parts you did not 
>> quote).
>
> I'm afraid I read the help closely several times and did not find that
> implication.
>
>> Otherwise 'line' would just duplicate mgp[3].
>
> Which is still useful functionality --- easier to supply a single value
> than to change one element of a 3-element vector.
>
>>> My interpretation is that axis() is taking mgp[2] rather than the
>>> correct mgp[2]-mgp[3] as the relative position of the tick mark with
>> 
>> Why is it correct when you have been told 'mgp[3]' was overridden?
>
> That was my best attempt to interpret the phrase "relative placing of
> ... tick labels", given that no graphics parameter is explicitly
> documented as having that meaning.
>
>> We could explicitly say it is treated as zero for ultimate clarity.
>> 
>>> respect to the axis line.
>
> To summarize (if I now understand things correctly): when the position
> of the axis line is determined by the value of mgp[3], then mgp[2] is
> the absolute position (number of lines into the margin) of the tick
> labels; but if the position of the axis line is determined by the 'line'
> or 'pos' arguments of axis(), then mgp[2] is the relative position of
> the tick labels (number of lines between the tick labels and the axis
> line).  If this is the intended behaviour, then certainly I think it
> would be helpful if it were explicitly documented.
>
>
> J. R. M. Hosking
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] axis() ignores supplied value of argument mgp[3]?
Prof Brian Ripley