Skip to content
Back to formatted view

Raw Message

Message-ID: <971536df0805281152ka3a801yb50f2b5d050c2e5@mail.gmail.com>
Date: 2008-05-28T18:52:52Z
From: Gabor Grothendieck
Subject: A small modification of plot.acf (patch)
In-Reply-To: <5f0660120805280908i27ddf244sf8f76be86f113200@mail.gmail.com>

The changes seem reasonable to me but here is a workaround
just in case (using builtin BOD and letters as examples):

i <- 0
setHook("plot.new", function() title(letters[i <<- i+1]))
acf(BOD, main = "")
setHook("plot.new", NULL, "replace")

On Wed, May 28, 2008 at 12:08 PM, ?????? ????????? <cmr.pent at gmail.com> wrote:
> 2008/5/27 Prof Brian Ripley <ripley at stats.ox.ac.uk>:
>> That is the part that needs justification.  I've never seen an example where
>> that was the case (and you don't give one), and I use acf() a lot. The
>> examples fit and their series names are not particularly short.
>>
>> Also, the user has the option to supply 'main' to plot.acf via '...', so why
>> is that not sufficient?  And you can even suppress the title by main="" and
>> use title() for even more control.
>>
>
> Here is an example with real-life series names and plot dimensions:
>
> data <- cbind('????? ???????'  = arima.sim(n = 100, list(ar = 0.5)),
>             '???. ?????????' = arima.sim(n = 100, list(ar = 0.1)))
>
> x11(width = 4.8, height = 4.2)
> acf(data, mar = c(3, 3, 3, 1) + 0.1, cex.main = 1)
>
> I have tried to supply main argument to the acf function:
>
> acf(data, mar = c(3, 3, 3, 1) + 0.1, cex.main = 1,
>   main = matrix(c('????? ???????',
>     '????? ??????? &\n???. ?????????',
>     '????? ??????? &\n???. ?????????',
>     '???. ?????????'), 2, 2))
>
> but it doesn't work the desired way. Please see the implementation of
> plot.acf. title function doesn't seem to play well with par(mfrow = ),
> so it doesn't help, too.
>
> In principle, it's not *that* hard to implement a custom version of
> multivariate acf plot, but the current version of plot.acf provides
> some sweet features like y-axes alignment etc. Writing another
> plot.acf will inevitably lead to massive code duplication, which is
> bad.
>
> I have several ideas of how to tweak current plot.acf so it would
> suffice my needs:
>
> 1) Add new main.sep argument (see the patch).
>
> 2) Let plot.acf recognize if main is a matrix and use its elements for
> different plots, not just coerce it to vector and pass to every title.
>
> 3) Let plot.acf recognize if main is a function and call it with 2
> arguments (i-series name and j-series name) to compose captions.
>
> 1) seems to be the easiest for a user, 2) and 3) provide more freedom.
>
> Andrey Paramonov
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>