Skip to content

Commit 9741da5

Browse files
authored
Add oob arguments to date/datetime position scales. (#4229)
* Add `oob` arguments to date/datetime position scales. * Re-oxygenate * Add NEWS bullet for date(time) oob arguments.
1 parent ac2b5a7 commit 9741da5

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
`scale_*(guide = FALSE)` to remove a guide. Please use
1717
`guides(<scale> = "none")` or `scale_*(guide = "none")` instead
1818
(@yutannihilation, #4094).
19+
20+
* Date and datetime position scales support out-of-bounds (oob) arguments to
21+
control how limits affect data outside those limits (@teunbrand, #4199).
1922

2023
* `stat_bin()`'s computed variable `width` is now documented (#3522).
2124

R/scale-date.r

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ scale_x_date <- function(name = waiver(),
6666
date_minor_breaks = waiver(),
6767
limits = NULL,
6868
expand = waiver(),
69+
oob = censor,
6970
guide = waiver(),
7071
position = "bottom",
7172
sec.axis = waiver()) {
@@ -84,6 +85,7 @@ scale_x_date <- function(name = waiver(),
8485
guide = guide,
8586
limits = limits,
8687
expand = expand,
88+
oob = oob,
8789
position = position
8890
)
8991

@@ -101,6 +103,7 @@ scale_y_date <- function(name = waiver(),
101103
date_minor_breaks = waiver(),
102104
limits = NULL,
103105
expand = waiver(),
106+
oob = censor,
104107
guide = waiver(),
105108
position = "left",
106109
sec.axis = waiver()) {
@@ -119,6 +122,7 @@ scale_y_date <- function(name = waiver(),
119122
guide = guide,
120123
limits = limits,
121124
expand = expand,
125+
oob = oob,
122126
position = position
123127
)
124128

@@ -137,6 +141,7 @@ scale_x_datetime <- function(name = waiver(),
137141
timezone = NULL,
138142
limits = NULL,
139143
expand = waiver(),
144+
oob = censor,
140145
guide = waiver(),
141146
position = "bottom",
142147
sec.axis = waiver()) {
@@ -156,6 +161,7 @@ scale_x_datetime <- function(name = waiver(),
156161
guide = guide,
157162
limits = limits,
158163
expand = expand,
164+
oob = oob,
159165
position = position
160166
)
161167

@@ -175,6 +181,7 @@ scale_y_datetime <- function(name = waiver(),
175181
timezone = NULL,
176182
limits = NULL,
177183
expand = waiver(),
184+
oob = censor,
178185
guide = waiver(),
179186
position = "left",
180187
sec.axis = waiver()) {
@@ -194,6 +201,7 @@ scale_y_datetime <- function(name = waiver(),
194201
guide = guide,
195202
limits = limits,
196203
expand = expand,
204+
oob = oob,
197205
position = position
198206
)
199207

man/scale_date.Rd

Lines changed: 14 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)