如何更改当前的绘图窗口大小(R) [英] How to change current Plot Window Size (in R)

查看:710
本文介绍了如何更改当前的绘图窗口大小(R)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,假设我这样做:

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

现在我想要做

 plot(1:40)

但我想要一个更大的窗口对于它。



我猜测做的方法是(假设我不想打开一个新窗口)做

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

哪一个当然不起作用。



我看到的唯一解决方案是关闭窗口并开始一个新的。 (这将结束我的绘图历史)

有没有更好的方法?



谢谢。

解决方案

这是我的解决方案:

  {
#适用于windows
dev.off(); #dev.new(width = 6,height = 6)
windows(记录= TRUE,宽度=宽度,高度=高度)
}
resize.win(5,5)
plot(rnorm(100))
resize.win(10,10)
plot(rnorm(100))


For example. Assume I do:

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

And now I wish to do

plot(1:40)

But I want a bigger window for it.

I would guess that the way to do it would be (assuming I don't want to open a new window) to do

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

Which of course doesn't work.

The only solution I see to it would be to turn off the window and start a new one. (Which will end my plotting history)

Is there a better way ?

Thanks.

解决方案

Here is a my solution to this:

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))

这篇关于如何更改当前的绘图窗口大小(R)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆