Skip to content
Prev 43099 / 63421 Next

I wish xlim=c(0, NA) would work. How about I send you a patch?

I would say that Bill's example of reversing the axis range, which I have used many times over the years, along with Duncan's list of potential consequences for a myriad of functions/packages, are arguments against this change. 

Classically, R's defaults are generally sensible and if one wants to alter them, it is not unreasonable to expect some understanding of what the arguments are doing. To know how to manipulate a plot's axis ranges is not overly complicated. Knowing that R, by default, will extend them by 4% is arguably a little more subtle, but reading the documentation (eg. ?par) will enlighten one to that point.

To simply use:

  xlim = c(0, max(x))

or

  xlim = c(0, max(x, na.rm = TRUE))

or 

  xlim = c(0, max(x[is.finite(x)]))

depending upon what values in x (or y) one might have to worry about, or the reverse for an unknown min and a fixed max, is a reasonable solution to the issue that Paul raises. It is a few more keystrokes than using NA and avoids the myriad known and potentially unanticipated side effects.

Regards,

Marc Schwartz
On Apr 16, 2012, at 1:26 PM, William Dunlap wrote: