Skip to content

Commit 1023861

Browse files
authored
Only apply limits if they are not NA (#4419)
1 parent 668a51e commit 1023861

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ggplot2 (development version)
22

3+
* Fix a bug in `qplot()` when supplying `c(NA, NA)` as axis limits
4+
(@thomasp85, #4027)
5+
36
* Fix bug in `geom_dotplot()` where dots would be positioned wrong with
47
`stackgroups = TRUE` (@thomasp85, #1745)
58

R/quick-plot.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE,
166166
if (!missing(xlab)) p <- p + xlab(xlab)
167167
if (!missing(ylab)) p <- p + ylab(ylab)
168168

169-
if (!missing(xlim)) p <- p + xlim(xlim)
170-
if (!missing(ylim)) p <- p + ylim(ylim)
169+
if (!missing(xlim) && !all(is.na(xlim))) p <- p + xlim(xlim)
170+
if (!missing(ylim) && !all(is.na(ylim))) p <- p + ylim(ylim)
171171

172172
p
173173
}

0 commit comments

Comments
 (0)