From maechler at stat.math.ethz.ch  Fri Aug 26 10:52:51 2016
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Fri, 26 Aug 2016 10:52:51 +0200
Subject: [Rd] "plot.ts" doesn't respect the value of "pch" (+ blocked
 from Bugzilla signups)
In-Reply-To: <22463.61533.589863.671988@stat.math.ethz.ch>
References: <76d55e22eb66c1138165946af6c6579f@libertymail.net>
	<188C9075-2462-4D84-A76A-51257F78CA7B@comcast.net>
	<22b035f3f5a41547a9a9b6caaa5a5c5d@libertymail.net>
	<22463.61533.589863.671988@stat.math.ethz.ch>
Message-ID: <22464.867.785962.473709@stat.math.ethz.ch>

>>>>> Martin Maechler <maechler at stat.math.ethz.ch>
>>>>>     on Fri, 26 Aug 2016 09:31:41 +0200 writes:

>>>>> Gregory Werbin <greg.werbin at libertymail.net>
>>>>>     on Thu, 25 Aug 2016 15:21:05 -0400 writes:

    >> I've had a chance to read the source more thoroughly. The chain of 
    >> events is as follows:

    >> 1. Local function `plotts()` is defined with argument `cex` that 
    >> defaults to `par("cex")`
    >> 2. `...` is passed to `plotts()`. If "cex" is an element in `...`, 
    >> inside `plotts()` the variable `cex` is assigned thereby (overriding the 
    >> default arg). Importantly, this means that the element "cex" is captured 
    >> and _removed_ from `...`. `...` is eventually passed to `plot.window()`.
    >> 3.
    >> - In the univariate case (NCOL(x) == 1): When `lines.default()` is 
    >> called to actually plot the data 
    >> (https://github.com/wch/r-source/blob/trunk/src/library/stats/R/ts.R#L588 
    >> and 
    >> https://github.com/wch/r-source/blob/trunk/src/library/stats/R/ts.R#L597 
    >> for reference), `cex` is not included in the call.
    >> - In the bivariate case (NCOL(x) > 1): Because "cex" was captured and 
    >> removed from `...`, it is not passed to `plot.default` when it is called 
    >> (https://github.com/wch/r-source/blob/trunk/src/library/stats/R/ts.R#L548).

    >> It turns out that the "eating" is not being done by `...` but by the 
    >> signature of `plotts`.

    >> The documentation currently reads:

    >>> ...: additional graphical arguments, see 'plot', 'plot.default' and 
    >>> 'par'.

    >> This, to me, suggests parity with the 'plot' function in how the 
    >> arguments in '...' are handled. Therefore either the code is wrong or 
    >> the documentation is incomplete and misleading.

    > the code is not perfect aka "wrong" .. so the bug is there.
    > Making the minimal reproducible example more concise,

    > plot(as.ts((-10:12)^3), type="b", cex=.5)
    > plot(     ((-10:12)^3), type="b", cex=.5)

    > should plot identically ... but currently don't

And there are more (such) problems,
E.g, lty, and lwd are not propagated, in the (x,y) case,

 plot.ts(as.ts(1:300), cumsum(rnorm(300)), type = "b", cex = 0.5, lwd = 2)

and also not in the "multiple" / matrix case.

I will commit a fix to  R-devel in a moment... but would be glad
for a careful review.

Martin



[Rd] "plot.ts" doesn't respect the value of "pch" (+ blocked from Bugzilla signups)
Martin Maechler