[R-SIG-Mac] changing default device settings (was strange behaviour when quitting)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Jul 22 10:21:04 CEST 2008
This does seem a lot of work to do something that could be done better
by
setHook(packageEvent("grDevices", "onLoad"),
function(...) grDevices::quartz.options(pointsize=9))
Changing cex will not do the same thing, and 'pointsize' is the preferred
way to scale all the text (and line spacings etc) for a plot device.
You could also have
newq <- function() { quartz() ; par(cex=0.75)}
options(device=newq)
or similar.
On Tue, 22 Jul 2008, Prof Brian Ripley wrote:
> Why do people call things they do not understand 'strange', and use subject
> lines that fail to mention key facts (the use of active bindings)?
>
> Are you saving the workspace? That will access the active binding (twice, I
> think). With
>
> .Last <- function() rm(newq, envir=.GlobalEnv)
>
> it should work. I tried
>
> invisible(makeActiveBinding("newq", function(...) cat("OK\n"), .GlobalEnv))
> .Last <- function() rm(newq, envir=.GlobalEnv)
>
> successfully.
>
>
>
> On Mon, 21 Jul 2008, Carl Witthoft wrote:
>
>> I have delved into the darkness :-),
>> and something odd is happening. I saw this w/ a couple versions of R 2.7.x
>> :
>>
>> First, I created an environment variable inside my .Rprofile (quoted
>> below). The variable itself works just fine. Here's the strange thing:
>> when I invoke q() or hit <CMD>-q to quit R.app , R throws up a new
>> Untitled window that looks like it might be a new quartz window, then goes
>> ahead and quits.
>>
>>
>> myRprofile: (ignoring lines which work and do NOT affect the quit()
>> behavior. I tested extensively and only this binding makes a difference)
>>
>> makeActiveBinding("newq", function(...) { quartz() ; par(cex=0.75)},
>> .GlobalEnv)->nullity
>> rm(nullity)
>
> I'd just wrap the call in invisible().
>
>> A couple notes: I redirect to the variable 'nullity' so that R.app won't
>> throw anything onto the console window. I put the ellipsis in because
>> otherwise I get a Warning about unused or missing arguments to function().
>>
>> I also tried putting the line
>>
>> rm(newq)
>>
>> into .Last, but that didn't help either.
>
> Did you not get an error?
>
>>
>> thanks for advice.
>> Carl
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-SIG-Mac
mailing list