>>>>> Paul Murrell writes:
> Hi
> ---snip---
> I am trying to change the number of the ticks on each axis, but every time
I
> can not succeed and receive the error message shown below even I use the
> default values:
>>
plot.mts(infldata1[,3:4],lty=c(1:2),plot.type="single",lab=c(5,5,7))
> Error in axis(side, at, labels, tick, line, pos, outer, font, vfont,
...)
> :
> location and label lengths differ, 6 != 3
> ---snip---
> The problem is that the "lab" parameter is being passed down (via
> plot.ts) to axis in a "..." argument, but it is being matched to
the
> "labels" argument in axis().
> In other words, axis() thinks you are saying "labels=c(5, 5, 7)".
> This is not your fault; it is an unfortunate interaction between
> partial matching of argument names and the "..." argument.
What a nightmare ...
> A simple workaround would be ...
> op <- par(lab=c(5, 5, 7)
> plot.mts(infldata1[,3:4],lty=c(1:2),plot.type="single")
> par(op)
[Argh. Calling a method directly ... ]
> ... a more long-term solution will require some more thought ...
> [to R-devel:
> (i) could put the labels argument at the end of the list -- i.e.,
> axis(side, at, tick, line, pos, outer, font, vfont, ..., labels) but then
> using "lab" as an abbreviation for "labels" would then
get consumed as a
> par() setting (?)
> (ii) could put explicit "lab" argument in the list too --
i.e.,
> axis(side, at, labels, tick, line, pos, outer, font, vfont, lab, ...) (?)
> (iii) ... ?]
I think we need general guidance for dealing with the ``graphical
parameter'' args to plotting functions. This includes issues of where
to evaluate and when to vectorize (or even how, ref my question about
recycling e.g. col by cases or variables when plotting a multivariate
time series).
In the above case, ?axis says that its `...' is
...: graphical parameters may also be passed as arguments to this
function.
so we could take the plot.ts `...' list, pmatch its names against
names(par()), and pass the subscripted `...' on to axis(). [Expecting
loud screams.]
-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._