[R-pkg-devel] use of `dev.new` across platforms in RStudio

Martin Maechler maechler at stat.math.ethz.ch
Sat Jun 13 14:01:46 CEST 2015


>>>>> Alex Chubaty <alex.chubaty at gmail.com>
>>>>>     on Fri, 12 Jun 2015 14:41:56 -0700 writes:

    > Dear list members,
    > Use of platform-specific code to open new plot devices (e.g., `quartz`,
    > `x11`) is discouraged in favour of using `dev.new`; however, this does not
    > work in RStudio. A purported solution introduced in R 3.1.1 was to call
    > `dev.new(noRStudioGD = TRUE)`, which works on Windows, but not OSX and
    > Ubuntu. On these paltforms `dev.new` does not open a new plotting window,
    > but instead a PDF device writing to file "Rplots.pdf".

Oh dear..

Of course this is a very good question from you as a package writer

    > How can I open a new plot window in my package in a CRAN-approved way 

I'm not involved in CRAN (but the R project!) but this is really
about tools in R's grDevices package to enable programmeRs to
write platform-portable code. 

Exactly for that reason did we invent and implement dev.new()
even though I was not much envolved in that, I've applauded the
solution (for R 2.7.0, April 2008) quite a bit.   
AFAIK this has become the de facto standard for opening a
graphics device -- "if possible interactive" -- explicitly and
portably.

I have neither been involved in the creation of the
'noRStudioGD' option, but from looking at  dev.new() it is clear
that it *should* work on all three platforms (Windows, Mac,
Linuxen).

It is really unfortunate that this still does not work reliably
(or stopped working with a new release of "something" ?)... 

Honestely, I believe it is primarily RStudio's responsibility to
ensure that something standard R as  dev.new()  keeps working in
their interface to R, and if it does not, at least contact the R
developers (R core) about it.
But yes, I don't have the background info about this and really
don't want to through any rocks... 
==> rather a "friendly" CC to get Rstudio's staff attention to
this issue.

    > that works reliably across platforms when using RStudio?
    > Perhaps this is an issue to take up with RStudio and/or
    > R-Devel directly, but I'd appreciate any insights or
    > suggestions any of you may have.

See above.  I hope this will be resolvable soon.
It's too bad that R 3.2.1 "RC" (release candidate) is basically
deep frozen already;  OTOH, if there's very localized
Rstudio-specific patch which would solve the issue ..


    > Thank you for your help,
    > Alex

You're welcome,
Martin



More information about the R-package-devel mailing list