1

I use 13' MacBook Pro Retina but when I tried plotting on the screen, it uses 7x7 inches plot size at default. This is beyond the vertical limit of the screen and hence I have to bother resizing the plotted window any time I plot because the x-label isn't displayed without resizing it.

But how can I do it? This answer uses windows() function but there is no such function available in my system!

Also, even if it is available, it seems that I still have to execute the command every time I plot, which is so annoying.

I want to set the size permanently. How can I do it?

Community
  • 1
  • 1
Blaszard
  • 30,954
  • 51
  • 153
  • 233
  • The equivalent of `windows()` is `quartz()` for Mac as per the answer by Purnendumaity (http://stackoverflow.com/a/15310665/5282315), however that's not a permanent setting. – Gwenaël Gouérou Oct 18 '15 at 15:42
  • @GwenaëlGouérou Thanks. I overlooked it. – Blaszard Oct 18 '15 at 15:46
  • I tried using `quartz()` as suggested above but I have a pathological hatred for calling it every time I plot. It is so insufferable... – Blaszard Oct 19 '15 at 01:22

1 Answers1

2

Sorry it took me some times to find it, it was simply written at the very bottom of the documentation for quartz.

To permanently change the default settings, you just need to include a line in your .Rprofile :


For a Mac solution :

setHook(packageEvent("grDevices", "onLoad"),
        function(...) grDevices::quartz.options(width = 6, height = 6))


You can then modify the default 7x7 width and height to whatever will suit your screen best.


For a Windows solution :

setHook(packageEvent("grDevices", "onLoad"),  
        function(...) grDevices::windows.options(width = 6, height = 6))  


For a X-window system solution :

setHook(packageEvent("grDevices", "onLoad"),  
        function(...) grDevices::X11.options(width = 6, height = 6))  



As for the .Rprofile file, it should be located in your start-up working directory.

If it doesn't exist, you can create a new one with your normal text editor but be sure to save it as .Rprofile (note the .) not as a .txt file.

You can also create it directly from RStudio :

- New File -> Text File
- write the code above inside it
- Save it with the name .RProfile
- quit and restart Rstudio

(or quit and restart R if you're working from the command line)

Note also that R will look for this file first in the current working directory, then in the user's home directory.