降低绘图循环的速度以查看 R 中的移动(无需单击)
Lowering the speed of a plot loop to see movements in R (without clicking)
我想知道如何降低下面 for()
循环的速度(即时间),以允许人眼在 R 中看到和触摸绘图更改(无需单击 enter 和只是慢慢地看着循环 运行)?
这里是一段R代码:
for (i in 1:50) {
plot(rnorm(40))
readline(prompt="Press [enter] to continue")
}
pauseLength = 4 # length of pause in seconds
for (i in 1:50) {
plot(rnorm(40))
Sys.sleep(pauseLength)
}
我想知道如何降低下面 for()
循环的速度(即时间),以允许人眼在 R 中看到和触摸绘图更改(无需单击 enter 和只是慢慢地看着循环 运行)?
这里是一段R代码:
for (i in 1:50) {
plot(rnorm(40))
readline(prompt="Press [enter] to continue")
}
pauseLength = 4 # length of pause in seconds
for (i in 1:50) {
plot(rnorm(40))
Sys.sleep(pauseLength)
}