![](/img/trans.png)
[英]How do I create an “interactive” graphics device based on off-screen (bitmap) graphics in R?
[英]Is it possible to resize an interactive R graphics device with R code?
When using R within an interactive windowing system (such as Windows, Ubuntu, MacOSX) the default behaviour for plot(x)
is to open an interactive graphics device (with plot.new()
under the hood), and draw stuff on it. 設備可以交互移動、調整大小和關閉,並且(取決於平台)呈現其他基於 GUI 的操作。 可以使用 R 代碼關閉或復制它,使用dev.off()
, dev.copy()
以及該系列中的其他功能。
可以使用 R 代碼移動設備或調整設備大小嗎?
我意識到這個問題可能有許多特定於平台的答案,歡迎提供所有細節。 我對最新版本的 R 的默認 Windows 安裝選項最感興趣,但渴望了解有關操作系統環境和其他選項之間差異的更多信息。
如果你真的想這樣做,你可以使用 GTK 庫和 cairoDevice package。 然后您可以使用 RGtk2 調用來調整大小。 它不是默認安裝,而是跨平台的。
library(RGtk2)
library(cairoDevice)
w = gtkWindow()
da <- gtkDrawingArea()
asCairoDevice(da)
w <- gtkWindow(show=FALSE)
w$add(da)
w$show()
hist(rnorm(100))
w$resize(500, 500)
w$move(200,200)
過去嘗試的集合,答案很少,但可能有用:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.