首页 > 解决方案 > 为什么绘图窗口的大小在 R 中保持不变?

问题描述

目前存在两个问题:

问题1: 感谢@Humpelstielzchen,这个问题已经解决,这是因为“noRStudioGD = TRUE”问题。

我查看了这篇文章,并尝试了 Shane 的答案,即:

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

然后我尝试将宽度从 5 更改为 10,看看是否有一些不同:

# the plot with width=10
dev.new(width=10, height=4)
plot(1:20)

但看起来图片的大小根本没有变化(看这里)。为什么会这样?

问题 2: 我更改了units =(厘米或英寸),但绘图窗口似乎没有变化。更奇怪的是,这两个窗户的宽度是23.2厘米,高度是10.5厘米:这些窗户的宽度既不是10厘米也不是10英寸,高度也不是4厘米或4英寸。

# units = "cm"
dev.new(width=10, height=4, noRStudioGD = TRUE, units = "cm")
plot(1:20, main = "units = cm")

# units = "inch"
dev.new(width=10, height=4, noRStudioGD = TRUE, units = "inch")
plot(1:20, main = "units = inch")

标签: r

解决方案


你所要做的


dev.new(width=10, height=4, noRStudioGD = TRUE, units = "cm")
plot(1:20)

他们显然改变了dev.new()前一段时间在 RStudio 中的行为。

描述中也有一些关于它的内容:? dev.new


推荐阅读