How to specify width and height of plot in R without using the parameters when opening the window

StackOverflow https://stackoverflow.com/questions/23683113

  •  23-07-2023
  •  | 
  •  

Question

I'd like to open a plot maximized.

I didn't find how to do that, but I can get there with width and height. e.g. I call X11(), maximize the window, call dev.size(), and then put those in manually, e.g. X11(width=25.8,height=14.3). Only that differs from machine to machine. So I'd like to define it in "Resources", as mentioned in the help:

the width and height of the plotting window, in inches.
If NA, taken from the resources and if not specified there
defaults to 7 inches. See also ‘Resources’.

Except I don't know how to "See also Resources". ?Resources doesn't work...

Some googling led to this:

setHook(packageEvent("grDevices", "onLoad"), 
  function(...) grDevices::X11.options(width=25.8, height=14.3,type="xlib"))

Except it isn't working for me...

The aim in the end would be to place a maximized function into each machine's .Rprofile.

For now I can get around that by just saving width and height in the .Rprofile, but still...

Thanks

Était-ce utile?

La solution

From comments, this is the way to do it:

X11.options(width=20,height=10)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top