开发者

iterate a sequence of plots

开发者 https://www.devze.com 2023-02-18 03:29 出处:网络
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.

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

精彩评论

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