Reputation: 6931
I've seen this lots of times, and just noticed it's also on the help page of par
:
The default is c(5, 4, 4, 2) + 0.1
Why is it that the default has this 0.1 addition, and it's also common to see + 0.1
when changing par(mar)
?
When setting par(mar=c(0, 0, 0, 0) + 0.1)
I thought the idea was to set a minimum margin, but it doesn't make sense for values different than zero.
Upvotes: 4
Views: 671
Reputation: 226192
I don't know, but S: An Interactive Environment for Data Analysis and Graphics (Becker and Chambers 1984, the first book on S, which is the ancestor of R) gives these defaults (search for xrig
) and says (p. 95)
(the appendix clarifies that this actually includes the additional 0.1, but doesn't give any additional explanation). I think that's the best you're going to do. John Chambers is still around; while he hasn't been active on the R-help mailing list since 2004 he continues to contribute to the development list ... even if you bug him, I'm not sure he would remember the rationale for a minor design decision he (or one of his co-authors) made more than 30 years ago ...
My own guess, for whatever that's worth, is that one might expect e.g. 4 lines' worth of material outside the left edge of the plot (e.g. ticks, tick labels, and a two-line axis label), with the 0.1 as "additional margin" so that text isn't exactly hitting the edge.
Upvotes: 8
Reputation: 31
Hi I had the same question as you, and when I looked for the answer I found your question. And from my understanding, the reason that default value has +0.1 is to keep at least x and y axis when you set par(mar=c(0, 0, 0, 0) + 0.1)
. Look at the picture below:
As you can see, though not that clear but still obvious, axis Y and X at the very margin of the picture. This means, when I set with code par(mar=c(0, 0, 0, 0)
, I will get the largest size of the graph (if there's no default +0.1, there would even be no axis X and Y).
Hope this can help you
Upvotes: 2