Skip to content

Commit 6724458

Browse files
committed
Fix error messages
1 parent d2fef6d commit 6724458

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

R/geom-ribbon.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ GeomRibbon <- ggproto("GeomRibbon", Geom,
145145
# these to vary
146146
non_constant <- setdiff(non_constant, c("fill", "alpha"))
147147
}
148-
if (length(non_constant) > 1) {
148+
if (length(non_constant) > 0) {
149149
cli::cli_abort(
150-
"Aesthetics can not vary along a ribbon: {.field {.and non_constant}}."
150+
"Aesthetics can not vary along a ribbon: {.and {.field {non_constant}}}."
151151
)
152152
}
153153
if (length(aes$fill) > 1 || length(aes$alpha) > 1) {

tests/testthat/_snaps/geom-ribbon.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
Problem while converting geom to grob.
1818
i Error occurred in the 1st layer.
1919
Caused by error in `draw_group()`:
20-
! Aesthetics can not vary along a ribbon.
20+
! Aesthetics can not vary along a ribbon: linewidth.
2121

2222
---
2323

tests/testthat/test-geom-ribbon.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test_that("geom_ribbon() checks the aesthetics", {
77
geom_ribbon(aes(y = year, xmin = level - 5, xmax = level + 5), orientation = "x")
88
expect_snapshot_error(ggplotGrob(p))
99
p <- ggplot(huron) +
10-
geom_ribbon(aes(year, ymin = level - 5, ymax = level + 5, fill = year))
10+
geom_ribbon(aes(year, ymin = level - 5, ymax = level + 5, linewidth = year))
1111
expect_snapshot_error(ggplotGrob(p))
1212

1313
expect_snapshot_error(geom_ribbon(aes(year, ymin = level - 5, ymax = level + 5), outline.type = "test"))

0 commit comments

Comments
 (0)