Skip to content

Commit 2e7015c

Browse files
committed
Merge branch 'fix/guide-with-null-breaks'
2 parents 2c085d8 + 5788cd4 commit 2e7015c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

R/scale-.r

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ continuous_scale <- function(aesthetics, scale_name, palette, name = NULL, break
4444
if (bad_labels) {
4545
stop("Breaks and labels have unequal lengths", call. = FALSE)
4646
}
47+
48+
if (is.null(breaks) && !is_position_aes(aesthetics) && guide != "none") {
49+
guide <- "none"
50+
}
4751

4852
trans <- as.trans(trans)
4953
if (!is.null(limits)) {
@@ -125,7 +129,11 @@ discrete_scale <- function(aesthetics, scale_name, palette, name = NULL, breaks
125129
if (bad_labels) {
126130
stop("Breaks and labels have unequal lengths", call. = FALSE)
127131
}
128-
132+
133+
if (is.null(breaks) && !is_position_aes(aesthetics) && guide != "none") {
134+
guide <- "none"
135+
}
136+
129137
structure(list(
130138
call = match.call(),
131139

0 commit comments

Comments
 (0)