Reputation: 7517
I'm wondering if I can have R add a bit more (say by a factor of 1/3) to its default upper limit of ylim = c(a, b)
(here: b + 1/3 * b
) when plotting anything?
Maybe you can show this in this R code:
plot(1:10, type="l", ann=FALSE)
or this:
curve(dnorm(x), -3, 3)
Upvotes: 2
Views: 652
Reputation: 226182
Unfortunately, I don't think so. Almost all of the details of graphical parameter settings in base graphics are documented in the ?par
page: in this case yaxs
is the only relevant setting:
‘yaxs’ The style of axis interval calculation to be used for the y-axis. See ‘xaxs’ above.
and:
‘xaxs’ The style of axis interval calculation to be used for the x-axis. Possible values are ‘"r"’, ‘"i"’, ‘"e"’, ‘"s"’, ‘"d"’. The styles are generally controlled by the range of data or ‘xlim’, if given. ... Style ‘"r"’ (regular) first extends the data range by 4 percent at each end and then finds an axis with pretty labels that fits within the extended range.
The 4 percent value is hard-coded here:
case 'r':
temp = 0.04 * (max-min);
min -= temp;
max += temp;
break;
You could use ggplot2
or lattice
plots (which allow more customization) or write your own wrapper to modify the limits ...
Upvotes: 2