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. The device can be interactively moved, resize and closed, and (depending on the platform) presents other GUI-based operations. It can be closed or copied with R code, with dev.off()
, dev.copy()
and there are other functions in the family.
Can the device be moved or resized using R code?
I realize that this question may have many platform-specific answers, and all and any detail is welcome. I am most interested in the default Windows install options for the latest version of R, but keen to learn more about the differences between OS environments and other options.
Abstract. The R. devices package provides functions for creating plots and image files in a unified way regardless of output format (EPS, PDF, PNG, SVG, TIFF, WMF, etc.). Default device options as well as scales and aspect ratios are controlled in a uniform way across all device types.
If you really wanted to do this, you could use the GTK libraries and the cairoDevice package. Then you can resize things with RGtk2 calls. It isn't the default install, but is cross platform.
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)
A collection of past attempts with few answers but possibly useful:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With