Skip to content

Commit 00a7b9a

Browse files
teunbrandthomasp85
andauthored
Update aesthetics of length 1 warning (#5799)
* update message * update snapshot * Update R/layer.R Co-authored-by: Thomas Lin Pedersen <[email protected]> * propagate suggestion to snapshot --------- Co-authored-by: Thomas Lin Pedersen <[email protected]>
1 parent d72caf5 commit 00a7b9a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

R/layer.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ Layer <- ggproto("Layer", NULL,
334334
&& length(aes_n) > 0 && all(aes_n == 1) && n > 1) {
335335
cli::cli_warn(c(
336336
"All aesthetics have length 1, but the data has {n} rows.",
337-
i = "Did you mean to use {.fn annotate}?"
337+
i = "Please consider using {.fn annotate} or provide this layer \\
338+
with data containing a single row."
338339
), call = self$constructor)
339340
}
340341
check_aesthetics(evaled, n)

tests/testthat/_snaps/layer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
# layer warns for constant aesthetics
8888

8989
All aesthetics have length 1, but the data has 32 rows.
90-
i Did you mean to use `annotate()`?
90+
i Please consider using `annotate()` or provide this layer with data containing a single row.
9191

9292
# layer_data returns a data.frame
9393

0 commit comments

Comments
 (0)