Two features that I'd find useful for x/ylim adjustments:
-
Manual override of just one limit. ggplot2 enables this by letting one of the limits be NA, e.g. xlim(0, NA) ensures the lower limit extends to zero while the upper limit is set by the data range. We could adopt an equivalent API: x/ylim = c(0, NA).
-
Ensure limit covers a particular value. My motivating use case is ensuring that the zero is displayed on the y-axis for a coefficient plot. (This could be useful feature for package developers, for instance.) I don't know if it's trying to be too cute with the API, but one option would be to allow a single value scalar as a limit argument, e.g., ylim = 0. In such single value cases we would resolve the plot limits as extendrange(c(y, ylim)) internally to ensure that the latter value is covered.
Two features that I'd find useful for
x/ylimadjustments:Manual override of just one limit.
ggplot2enables this by letting one of the limits be NA, e.g.xlim(0, NA)ensures the lower limit extends to zero while the upper limit is set by the data range. We could adopt an equivalent API:x/ylim = c(0, NA).Ensure limit covers a particular value. My motivating use case is ensuring that the zero is displayed on the y-axis for a coefficient plot. (This could be useful feature for package developers, for instance.) I don't know if it's trying to be too cute with the API, but one option would be to allow a single value scalar as a limit argument, e.g.,
ylim = 0. In such single value cases we would resolve the plot limits asextendrange(c(y, ylim))internally to ensure that the latter value is covered.