Skip to content

Commit a9df27d

Browse files
Do not flip eagerly when both axis are discrete like (#3763)
Fix #3761
1 parent 5e6b1e5 commit a9df27d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

R/utilities.r

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,15 @@ has_flipped_aes <- function(data, params = list(), main_is_orthogonal = NA,
598598
if (all(y == 1)) {
599599
return(!main_is_continuous)
600600
}
601-
# If both are discrete like, which have most 0 or 1-spaced values
601+
602602
y_diff <- diff(sort(y))
603603
x_diff <- diff(sort(x))
604604

605+
# FIXME: If both are discrete like, give up. Probably, we can make a better
606+
# guess, but it's not possible with the current implementation as very little
607+
# information is available in Geom$setup_params().
605608
if (y_is_int && x_is_int) {
606-
return((sum(x_diff <= 1) < sum(y_diff <= 1)) != main_is_continuous)
609+
return(FALSE)
607610
}
608611

609612
y_diff <- y_diff[y_diff != 0]

0 commit comments

Comments
 (0)