Skip to content
 

Could someone please set this as the new R default in base graphics?

par (mar=c(3,3,2,1), mgp=c(2,.7,0), tck=-.01)

Thank you.

10 Comments

  1. jme says:

    How hard can it be to write a single R script that sets all your preferred defaults and call it with source() at the start of everything you do? ;)

  2. Greg says:

    I've changed some of my defaults – you can put it in your .Rprofile and set it on your R, if you want.

  3. John says:

    tick should be .02

  4. Yihui says:

    You can put this in your .Rprofile:

    <pre>setHook('plot.new', function(…) par(mar=c(3,3,2,1), mgp=c(2,.7,0), tck=-.01))</pre>

    Then every time you create a new plot, this par settings will be applied (for base R graphics, of course). Furthermore, you will always have to use this setting.

  5. Ben Bolker says:

    perhaps las=1, bty="l" (for Tufte-correctness, not wasting ink) while we're at it? And we should really do
    palette(c("black","red","blue","cyan","magenta","green3","yellow","gray")) [i.e. move green farther down the list] to encourage dichromat-friendly colo[u]r schemes … (once you get to yellow and gray you're usually getting a little desperate in any case)

  6. Raymond says:

    Could someone please set the default regression summary so that it tells you the number of observations used in the regression? You figure something as simple as this would be in the default/base package.

  7. Andrew Gelman says:

    Raymond: Use display().

  8. Dodgy default settings in base graphics are there to encourage you to learn to use lattice or ggplot2. :)

  9. Henrik says:

    I just reread the R-intro.pdf (in the Rdocmanual folder) which contained the answer on how to set this (and everything else you want) globally. Just add the lines to the file ‘Rprofile.site’ in the R home subdirectory ‘etc’ (you can even add the source statement to load your personal functions).

    The problem with adding it to .Rprofile is that it (basically) only works if R is started from that directory.

    See 10.8 of the R-intro.pdf for a short but concise treatment of "Customizing the environment".

  10. Andrew Gelman says:

    Hi, all. Those suggestions are good, but I want to change the defaults for everyone, not just me!