19

例えば。私がそうすると仮定します:

dev.new(width=5, height=4)
plot(1:20)

そして今、私はしたいです

plot(1:40)

しかし、私はそれのためのより大きな窓が欲しいです。

それを行う方法は(新しいウィンドウを開きたくないと仮定して)することだと思います

plot(1:40, width=10, height=4)

もちろん、これは機能しません。

私が見る唯一の解決策は、ウィンドウをオフにして新しいウィンドウを開始することです。(これで私のプロットの歴史は終わります)

より良い方法はありますか?

ありがとう。

4

2 に答える 2

13

いくつかの回避策は、dev.new() R 関数を使用するのではなく、プラットフォーム全体で機能するはずのこの関数を使用することです。

 dev.new <- function(width = 7, height = 7) 
 { platform <- sessionInfo()$platform if (grepl("linux",platform)) 
 { x11(width=width, height=height) } 
 else if (grepl("pc",platform)) 
 { windows(width=width, height=height) } 
 else if (grepl("apple", platform)) 
 { quartz(width=width, height=height) } }
于 2013-03-09T12:28:48.457 に答える
10

これに対する私の解決策は次のとおりです。

resize.win <- function(Width=6, Height=6)
{
        # works for windows
    dev.off(); # dev.new(width=6, height=6)
    windows(record=TRUE, width=Width, height=Height)
}
resize.win(5,5)
plot(rnorm(100))
resize.win(10,10)
plot(rnorm(100))
于 2010-03-03T18:30:25.417 に答える