开发者

iterate a sequence of plots

I'd like to be able to iterate through a sequence of plots similar to how plot.lm() does

I have this so far but it doesn't update the plot, just shows initial values.

Anyone ideas how to get working as intended?

iterateResu开发者_如何学编程lts <- function(x)
{
    oask <- devAskNewPage(TRUE)
    on.exit(devAskNewPage(oask))
    for (i in 1:length(x))
    {
        plot(x[1]:x[i])
    }
}


Also, there is the good old par(ask = TRUE)


Your pause between graphs functionality works for me. Did you mean to have the key command be plot(x[seq(i)]) instead? Otherwise it just plots the indices.

Note that in general seq(length(x)) is preferred to 1:length(x) because if length(x)==0 then you've got a problem using the colon operator. seq_along(x) is simpler still.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜