Skip to content

Commit 6b8dba0

Browse files
Avoid "<empty>" labels with qplot() (#4191)
1 parent 813d0bd commit 6b8dba0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

R/quick-plot.r

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,19 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE,
8989

9090

9191
if (is.null(xlab)) {
92-
xlab <- as_label(exprs$x)
92+
# Avoid <empty> label (#4170)
93+
if (quo_is_missing(exprs$x)) {
94+
xlab <- ""
95+
} else {
96+
xlab <- as_label(exprs$x)
97+
}
9398
}
9499
if (is.null(ylab)) {
95-
ylab <- as_label(exprs$y)
100+
if (quo_is_missing(exprs$y)) {
101+
ylab <- ""
102+
} else {
103+
ylab <- as_label(exprs$y)
104+
}
96105
}
97106

98107
if (missing(data)) {

0 commit comments

Comments
 (0)