@@ -457,13 +457,14 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
457
457
x_labels <- scale_x $ labels
458
458
}
459
459
460
- if (is.character(x_labels )) {
460
+ # all labels need to be temporarily stored as character vectors,
461
+ # but expressions need to be parsed afterwards
462
+ if (is.character(x_labels ) || is.factor(x_labels )) {
461
463
needs_parsing [graticule $ type == " E" ] <- FALSE
462
464
} else {
463
- # all labels need to be temporarily stored as character vectors
464
- x_labels <- as.character(x_labels )
465
465
needs_parsing [graticule $ type == " E" ] <- TRUE
466
466
}
467
+ x_labels <- as.character(x_labels )
467
468
}
468
469
469
470
if (length(x_labels ) != length(x_breaks )) {
@@ -485,13 +486,14 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
485
486
y_labels <- scale_y $ labels
486
487
}
487
488
488
- if (is.character(y_labels )) {
489
+ # all labels need to be temporarily stored as character vectors,
490
+ # but expressions need to be parsed afterwards
491
+ if (is.character(y_labels ) || is.factor(y_labels )) {
489
492
needs_parsing [graticule $ type == " N" ] <- FALSE
490
493
} else {
491
- # all labels need to be temporarily stored as character vectors
492
- y_labels <- as.character(y_labels )
493
494
needs_parsing [graticule $ type == " N" ] <- TRUE
494
495
}
496
+ y_labels <- as.character(y_labels )
495
497
}
496
498
if (length(y_labels ) != length(y_breaks )) {
497
499
stop(" Breaks and labels along y direction are different lengths" , call. = FALSE )
0 commit comments