grDevices::dev.size()可以以编程方式提供RStudio Viewer窗格的大小。
是否有类似的命令(或者甚至是技巧)可以以编程方式获取Zoom窗口的大小?在rstudioapi命令的简要搜索中似乎没有提供任何线索。
我已经很久没有遇到类似的问题了。你找到答案了吗?
我采用了这个解决方案:
}
x11() # open new window
boxplot(rnorm(100)) # wrtie some good box full of normal values.
#Plot it! You will see it on the new screen.
#Now, let's make this loop, and everything will appear.
while(TRUE){
cdev <- grDevices::dev.size("cm")
Sys.sleep(0.5)
cat("Width (cm):", cdev[1], "High (cm):", cdev[2], "\r")
cat("Press escape to break it.")
}
#Change the new windows number size, and those new numbers will flow.